-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically generated subscriptions seem to be wrong. #381
Comments
👋 @hickscorp This library is created and maintained by me, @budde377. Please consider supporting my work and ensure our survival by donating here. |
@hickscorp does this section of the readme cover your case? https://github.com/heftapp/graphql_codegen/tree/main/packages/graphql_codegen#excluding-some-selections-from-adding-typename |
@mvarendorff I am answering from my phone, so I looked at the link you attached and I feel silly for even having raised the issue. I apologize. I will try it when I have access to the computer and report back. Thanks a bunch for "googling better than me" 👍 |
Hi there again @mvarendorff , I have tried what you suggested and I can confirm that it works. |
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__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.
The text was updated successfully, but these errors were encountered: