Skip to content

Commit 519787a

Browse files
committed
Update context class option description
1 parent 2db3f58 commit 519787a

File tree

1 file changed

+8
-1
lines changed
  • content/tools/schema-parser-options

1 file changed

+8
-1
lines changed

content/tools/schema-parser-options/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ Use `SchemaParserOptions.newBuilder()` to build an options object to pass to the
1414

1515
Options:
1616

17-
* `contextClass`: If you use a context object to execute your queries, let the parser know about it so that it can add it to data fetchers as an argument.
17+
* `contextClass`: If you use a custom context object to execute your queries, let the parser know about it so that it can add it to data fetchers as an argument.
18+
Make sure to also provide your context instance to the execution input:
19+
```java
20+
var executionInput = ExecutionInput.newExecutionInput()
21+
.query(query)
22+
.variables(variables)
23+
.graphQLContext(Map.of(CustomContext.class, context));
24+
```
1825
* `genericWrappers`: Allows defining your own generic classes that should be unwrapped when matching Java types to GraphQL types. You must supply the class and the index (zero-indexed) of the wrapped generic type. For example: If you want to unwrap type argument `T` of `Future<T>`, you must pass `Future.class` and `0`.
1926

2027
* `useDefaultGenericWrappers`: Defaults to `true`. Tells the parser whether or not to add it's own list of well-known generic wrappers, such as `Future` and `CompletableFuture`.

0 commit comments

Comments
 (0)