I’m trying to understand the following sentence from the GraphQL spec:
While each subscription must have exactly one root field,
a document may contain any number of operations,
each of which may contain different root fields.
When executed, a document containing multiple subscription
operations must provide the operation name as described in GetOperation().
I understand that a subscription operation can only have one root level field, but I interpret the above to mean that a document can have multiple subscription operations. Therefore, I expected the following to work (pseudo code naming below):
subscription EntityCreated {
entityCreated(input: {someField: 123}) {
entity {
id
}
}
}
subscription OtherEntityCreated {
otherEntityCreated(input: {someField: 456}) {
entity {
id
}
}
}
But I’m getting the following error: "Must provide a valid operation name if query contains multiple operations.\n\nNo operation name was given.\n"
. I’m encountering this error with both assert_reply
and assert_push
using the document above.
What am I missing? It seems I’m including two unique operation names, EntityCreated
and OtherEntityCreated
.