aPureBase / KGraphQL

Pure Kotlin GraphQL implementation
https://kgraphql.io
MIT License
298 stars 58 forks source link

Attach values to the context object within resolvers #129

Open jeggy opened 3 years ago

jeggy commented 3 years ago

it would be nice to have support for adding values unto the context inside a resolver, which then will be available inside other resolvers, just like when defining the root level definition of a context.

Could be something like this:

property<String>("myValue") {
  resolver { myType, ctx: Context ->
    val str: String = service.loadString(myType.id)
    ctx.put("myValue", str)
    str
  }
}