Is the data loader's per-key context allowed to be null?
skingsland opened this issue · comments
Steve Kingsland commented
Based on looking at the code and testing it, it appears that this data fetcher will pass through the key context to the data loader, even if it's null:
TypeRuntimeWiring.newTypeWiring("Query")
.dataFetcher(
"myField",
environment -> {
String myId = environment.getArgument("myId");
// it's OK if this is null, because the keyContext is allowed to be null?
Integer myKeyContext = getNullableKeyContext(...);
return environment.getDataLoader("myLoader").load(myId, myKeyContext);
})
.build();
Can you confirm, that though? Because nothing I found in the Javadocs or https://www.graphql-java.com/documentation/v16/batching#passing-context-to-your-data-loader says whether the per-key context is allowed to be null
.