With Micronaut what is the best way to set contextual data? #1142
Replies: 1 comment
-
Hello @govinda-attal The What you are looking for is the It is the class that is responsible for passing the the context and the data loader registry to your You shouldn't need to specify a custom |
Beta Was this translation helpful? Give feedback.
-
Excellent framework! This library simply rocks! And so wanted to check how I could use it with the Micronaut framework.
With this regards, need your help to understand what's the best way (graphql-kotlin idomatic way) to set contextual data when using the Micronaut framework. Appreciate that there is fantastic documentation for Spring. But similar love was missing for the Micronaut and Quarkus frameworks :-) which is always very helpful for beginners like me.
Please find a link to my example repo: source code
At a high level, I have followed these steps.
From graphql-kotlin documentation regarding contextual-data
following are the relevant aspects of the documentation I stumbled upon
Here I am not sure how to inform schema generator so that is it aware of the defined
GraphQLContext
. Also, not sure how to use FunctionDataFetcher to inject the context, as it doesn't have easy access to the HTTPRequest.and from graphql-kotlin documentation regarding graphql-context-factory
Here I am not sure how to inform schema generator so that is it aware of the defined
GraphQLContextFactory
(or should it?).I tried to look into the
graphql-kotlin
documentation and was not able to identify a way I could code when using Micronaut.So, I am not really sure, the steps that I have followed is the best way to use this library with the Micronaut framework or there is a better way to do so.
Any pointers will greatly help :-)
Here is the graphql schema configuration part of my code:
Beta Was this translation helpful? Give feedback.
All reactions