Allow multiple operations to be executed in one call
See original GitHub issueToday you can only execute 1 operation. The spec says you can only do that but I feel its an unnecessary restriction.
I would like graphql-java to introduce a experimental mode where you can provide a list of operation names to execute
So given this valid query
query Orders {
orders {
id
items {
name
}
}
}
query Billing {
billing {
dueDate
amount
}
}
We could execute both operations by specify the operation names in the ExecutionInput
ExecutionInput input = newInput().operations(toList("A","B")).build();
We would retain the current single operation name for backwards compatiblity.
If you did this then you need to get a combined execution result. The names of the operations would be the top level values
executionResult == {
"A" : {
"orders" : [ ...]
},
"B" : {
"billing" : {
...
}
}
}
The errors would be a combined list of executing operation A and then operation B
The operations would be executed in the order specified in the input list
Looking at the scope of changes (and spec enhancement) I think this is a good candidate for some library extension.
This is somewhat inspired from the Sangria implementation here : http://sangria-graphql.org/learn/#batch-executor
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Just wanted to bump this thread. Any reason not to revive this? We definitely have use cases for performing multiple operations in a single request.
closing this for now as multiple queries are not supported by the spec at the moment