Andres
03/14/2023, 4:44 PMjeggy
03/14/2023, 9:58 PMExecution.Node
to your arguments. Just like how Context
is a special argument, Execution.Node
as an argument will not be exposed to your schema, but KGraphQL will provide you with the node instance.
You can take a look at this example: https://github.com/aPureBase/KGraphQL/blob/main/kgraphql/src/test/kotlin/com/apurebase/kgraphql/integration/QueryTest.kt#L314Nahuel Ourthe
03/14/2023, 10:09 PMclass MyType
query("myType") { resolver { -> MyType() } }
type<MyType> {
property("field1") {
resolver { _ ->
"response to field1 from data base"
}
}
property("field2") {
resolver { _ ->
"response to field2 from data base"
}
}
}
So each resolver is executed only if the field is present in the query:
myType {
field1
}
myType {
field2
}
myType {
field1
field2
}