Closed jeggy closed 4 years ago
Currently there is no documentation on how to use context and the NotIntrospected annotation.
NotIntrospected
I quickly wrote an example of how it could be used:
val query = """ query fetchHelloLabel($country: String!) { hello(country: $country) { label } } """ val variables = """ {"country": "English"} """ val user = User(id = 1, name = "Username") val ctx = context { +user } schema.execute(query, variables, ctx) ... // In your schema definition query("hello") { resolver { country: String, ctx: Context -> val user = ctx.get<User>() Hello(label = "Hello ${user?.name ?: "unknown"}") } }
This is now available here: https://kgraphql.in/docs/reference/resolver/
Currently there is no documentation on how to use context and the
NotIntrospected
annotation.I quickly wrote an example of how it could be used: