I have a simple subscription such as:
subscription UserUpdated($id: ID!, $bearerToken: String!) {
userUpdated(bearerToken: $bearerToken, id: $id) {
id
email
fullName
}
}
Everything gets generated perfectly - and I can use different flavours of type-safe functions too... The problematic one seems to be Subscription$UserUpdated$Widget.
Server side when it's received, it looks like this:
[debug] ABSINTHE schema=PSWeb.Schema variables=%{"bearerToken" => "SOME_BEARER", "id" => "VXNlcjplM2Y0MTAxMC1iYjg2LTQwMmUtYjcxOS01YjMxOTgyOTBlNmY="}
---
subscription UserUpdated($id: ID!, $bearerToken: String!) {
userUpdated(bearerToken: $bearerToken, id: $id) {
id
email
fullName
__typename
}
__typename # <--- NOTICE THIS
}
---
Therefore the server answers something like:
OperationException(linkException: UnknownException({type: error, id: d5963283-e488-4f6a-8803-899d2f1c1129, payload: [{message: Only one field is permitted on the root object when subscribing, locations: [{line: 1, column: 1}]}]}, stack:
), graphqlErrors: [])
The variables and most of the document are correct - but notice that there's an extra typename - that goes against the GQL standard unless I'm mistaken. There can only be one root field per sub.
I tried playing with build option (Eg addTypename: false) it fixed the problem, but would like to keep __typename whenever possible as it's a good discriminator for runtime typechecks...
Am I missing something?
EDIT Apologies I forgot the spec / reference and for this particular case here.
I have a simple subscription such as:
Everything gets generated perfectly - and I can use different flavours of type-safe functions too... The problematic one seems to be
Subscription$UserUpdated$Widget.Server side when it's received, it looks like this:
Therefore the server answers something like:
The variables and most of the document are correct - but notice that there's an extra typename - that goes against the GQL standard unless I'm mistaken. There can only be one root field per sub.
I tried playing with build option (Eg
addTypename: false) it fixed the problem, but would like to keep__typenamewhenever possible as it's a good discriminator for runtime typechecks...Am I missing something?
EDIT Apologies I forgot the spec / reference and for this particular case here.