Currently, the GraphqlPostHandler constructs an ExecutionInput and executes the graphql query without providing an option for user provided DataLoaderRegistry
|
ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(query).operationName(operationName).context(exchange).root(exchange).variables(variables).build(); |
When using DataLoader we need to set dataLoaderRegistry
ExecutionInput executionInput = newExecutionInput()
.query(query)
.operationName(operationName)
.context(exchange)
.root(exchange)
.variables(variables)
.dataLoaderRegistry(registry) // <---
.build()
Alternatively, we should be able to use Instrumentation.instrumentExecutionInput(input, parameters), but there is a bug in graphql graphql-java/graphql-java#1667
It is still possible to do it via instrumentation but I think data loader registry could be added to router.
Currently, the
GraphqlPostHandlerconstructs anExecutionInputand executes the graphql query without providing an option for user providedDataLoaderRegistrylight-graphql-4j/graphql-router/src/main/java/com/networknt/graphql/router/handlers/GraphqlPostHandler.java
Line 89 in 808682f
When using
DataLoaderwe need to setdataLoaderRegistryAlternatively, we should be able to use
Instrumentation.instrumentExecutionInput(input, parameters), but there is a bug ingraphqlgraphql-java/graphql-java#1667It is still possible to do it via instrumentation but I think data loader registry could be added to router.