You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then you can just use the class as an argument and it will be automaticall injected during execution time.
28
31
32
+
```kotlin
29
33
classContextualQuery {
30
34
funcontextualQuery(
31
35
context:MyGraphQLContext,
@@ -51,10 +55,10 @@ Note that the argument that implements `GraphQLContext` is not reflected in the
51
55
52
56
### GraphQLContext Annotation
53
57
54
-
From the 1.x.x release we also support marking any argument with the annotaiton `@GraphQLContext`.
55
-
If the schema generator sees this annotation on an argument it will assume that this is the class used in the `GraphQLContextFactory` and return the context as this argument value.
56
-
This does require though that you mark every usage of the arument with the annotation. This can be helpful if you do no control the implementation of the context
57
-
class you are using.
58
+
From the 1.0.0 release we also support marking any argument with the annotaiton `@GraphQLContext`.
59
+
If the schema generator sees this annotation on an argument, it will assume that this is the context class and inject the context as this argument value.
60
+
This does require that you mark **all** usages of the arument with the annotation. This will cause an error if you incorrectly mark the wrong argument,
61
+
which is why the interface method may be better, but the annotation can be helpful if you do no control the implementation of the context class you are using.
0 commit comments