-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Inline fragment with omitted type misses fields #1972
Comments
I have come across this same issue myself, as mentioned in issue #3381. Versions
I have determined that this bug is caused during field collection here: gqlgen/graphql/executable_schema.go Line 45 in 1040b92
This fails to follow the specs algorithm (specifically this step) by not checking if there is a fragmentType ( Note: This may not have been noticed previously because omitting a type condition works for the most common operation directives All of this has been difficult to recreate and also just to follow, so I would like to submit a PR, if you think I've correctly identified the problem, that fixes this issue, follows the specification's algorithm more closely, and also adds an _examples directory for using |
This was addressed in #3384 and an explicit test case is added with #3399. If these are both merged I think this issue (and issue #3252) can be closed @StevenACoffman. |
What happened?
Tried to include an inline fragment with no type specified. According to the specification example 24 that should work. But the fields of the included fragment are not returned by the server.
What did you expect?
That the inline fragment fields are returned if the include condition is true.
Minimal graphql.schema and models to reproduce
Working query:
Output:
Non-working query:
Output:
versions
gqlgen version
?0.16.0
go version
?1.17.7
go modules
Because
sel.TypeCondition
is an empty string here the inline fragment gets wrongly left out.The text was updated successfully, but these errors were encountered: