-
Notifications
You must be signed in to change notification settings - Fork 103
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
graphql/required-fields rule ignores presence of required field in spread fragment #248
Comments
Similar issue, using #import "./MessageFragment.graphql"
mutation createMessage($input: MessageInput!) {
createMessage(input: $input) {
...MessageFragment
}
} fragment MessageFragment on Message {
id
snippedOtherFields
} |
Seems like it is the intended behaviour if I understand this comment properly:
|
I don't completely understand the comment, though. What does it mean for a fragment to cover all of the possible type options? |
I guess when you have something like this in your fragment:
But the parent supports:
or
At least this is how I understand it. |
I suppose a decision was taken not to implement checking fragments exhaustively to see if they include a required field. |
Yeah I guess so, not sure how hard it would be to implement that though |
It seems like field selection merging is part of the GraphQL specification: https://graphql.github.io/graphql-spec/draft/#sec-Field-Selection-Merging So this is not really a bug per se but more a feature request to be more exhaustive in checking for the inclusion of required fiels in fragments. |
My configuration:
My query:
Expected result
No linter error.
Actual result
Apparently the
required-fields
rule doesn't account for fields included in a fragment.Update
It seems like field selection merging is part of the GraphQL specification: https://graphql.github.io/graphql-spec/draft/#sec-Field-Selection-Merging
So this is not really a bug per se but more a feature request to be more exhaustive in checking for the inclusion of required fiels in fragments.
The text was updated successfully, but these errors were encountered: