Reputation: 3055
Currently, I'm learning Sangria-graphql with playframework and going through tutorial from here. I understand the Executor Executor.execute(schema, query, new ProductRepo)
which takes schema, query and context. On the other hand, as I go through demo example code, I came with following use of Executor where operationName and Variables are also provided. For instance,
Executor.execute(SchemaDefinition.StarWarsSchema, queryAst, new CharacterRepo,
operationName = operation,
variables = variables getOrElse Json.obj(),
deferredResolver = DeferredResolver.fetchers(SchemaDefinition.characters),
maxQueryDepth = Some(10))
.map(Ok(_))
I'm not quite getting it. If the variable means arguement for our query then query it self contain query params, such as id
in following query.
{
human(id: "1000") {
name
height(unit: FOOT)
}
}
Also, why and how the operationName is beneficial in this context? So, can anyone explain me about it along with how client provide query request for these operationName and variable.
Upvotes: 0
Views: 775
Reputation: 6547
Variables, in this case, means something different than parameters (like your id: "1000"
).
Have a look at the documentation of variables in GraphQL.
Same goes for the operationName
: documentation for this
Upvotes: 2