-
what's the preferred way to pass metadata from parent to child resolvers? An example of this would be as per below, I am trying to retrieve the manager node for each Employee, the employee has a unique identifier that is not part of the schema but I need to pass it down to the manager resolver. How can I do that? Initially, I thought about using GraphQLContext returned by getGraphQlContext, but it returns Global Context.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, you're right that the In plain GraphQL Java we've got a separate context concept called local context, have a look for I say "plain GraphQL Java" because things are slightly different if you use Spring for GraphQL, but I didn't want to go ahead too far in case local context is what you're after. |
Beta Was this translation helpful? Give feedback.
Hello, you're right that the
GraphQLContext
inside theExecutionContext
is global.In plain GraphQL Java we've got a separate context concept called local context, have a look for
getLocalContext
insideDataFetchingEnvironment
. This will pass on context from parent to child fields, and this context is not available globally.I say "plain GraphQL Java" because things are slightly different if you use Spring for GraphQL, but I didn't want to go ahead too far in case local context is what you're after.