Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

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.

You must be logged in to vote

Yes they can be null

Replies: 1 comment

Comment options

Yes they can be null

You must be logged in to vote
0 replies
Answer selected by skingsland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #76 on July 31, 2021 10:14.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.