Replies: 1 comment 8 replies
-
If you look at the section just above where you linked, we have outlined why we deprecated the interface. This features is really just a shorthand for the // Set in the context factory
class MyContext(val foo: String)
class ContextualQuery : Query {
fun contextualQuery(dfe: DataFetchingEnvironment, value: Int): String {
val context = dfe.context as MyContext
return "The context value was ${context.foo} and the value was $value"
}
} You should migrate to this pattern going forward and stop using our custom interface. The second part is that in graphql-java 17, the context changed from a generic object that you create to being a |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Im upgrading to v5.2.0 and I am curious what the long term plan is around the now deprecated context injection functionality.
https://github.com/ExpediaGroup/graphql-kotlin/blob/master/website/docs/schema-generator/execution/contextual-data.md#interface-injection-deprecated
The example below will not generate any deprecation warnings even though the
GraphQLContext
interface itself has been deprecated. This may sneak up on some users when the injection "magic" suddenly stops working. Not sure what the best approach is here. Maybe log a warning at runtime? Thanks in advance for taking a look at this.Beta Was this translation helpful? Give feedback.
All reactions