You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the global and local context are exposed as an opaque Object which makes it a challenge for sharing across frameworks or components from different parties.
It would be great if GraphQL Java could help establish a common understanding of what the context type is as a generic container such as graphql.GraphQLContext so that different parties can agree on how to access or update it. Of course this would require awareness the context is a shared container and therefore keys need to be reasonably unique, or perhaps to use a single (unique) root key with a sub-map underneath, but this shouldn't be much of a challenge.
Given the widespread use of the existing context() and localContext(), these could be alternative methods that provide a migration path.
The PR I have up changes the global context object to be the more map like GraphqlContext shape and hence is better for sharing
I am still torn on the idea of "local context" being a shared place for code. Perhaps if I had the time again it too should be a shaped container like GraphqlContext - however its also even more specific to the application layer because its opted into by DataFecthers themselves and creates a specific contract between parent fields and child fields
I don't think it applies to Frameworks as much as say global context. Its actually more painful a change in a way as well. Well maybe its not but I am still not as convinced it will deliver the benefit that warrants the pain of change
Indeed I suggested the global and local context be updated so they are aligned with each other. If local context is proving more difficult, it could also be postponed until there is more motivation for it.
Activity
bbakerman commentedon Jun 5, 2021
The PR I have up changes the global context object to be the more map like GraphqlContext shape and hence is better for sharing
I am still torn on the idea of "local context" being a shared place for code. Perhaps if I had the time again it too should be a shaped container like GraphqlContext - however its also even more specific to the application layer because its opted into by DataFecthers themselves and creates a specific contract between parent fields and child fields
I don't think it applies to Frameworks as much as say global context. Its actually more painful a change in a way as well. Well maybe its not but I am still not as convinced it will deliver the benefit that warrants the pain of change
rstoyanchev commentedon Jun 9, 2021
Indeed I suggested the global and local context be updated so they are aligned with each other. If local context is proving more difficult, it could also be postponed until there is more motivation for it.