-
Notifications
You must be signed in to change notification settings - Fork 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
Fragment safe divergence does not consider field nullability #1361
Comments
@joshjcarrier Thanks for very detailed issue 👍
It's implemented according to the specification: However, specification doesn't set in stone so if you think that it should be changed please submit an issue in this repo: https://github.com/facebook/graphql If you can't change your schema you can use the following workaround: {
pet {
... on Cat {
name
}
... on Dog {
nullableName: name
}
}
} |
I just added graphql-js as a gateway to an existing GraphQL-service, in order to extend it. The existing service does not implement this part of the spec, leading to the whole frontend crashing. Until we've refactored I did the following workaround: import { specifiedRules } from 'graphql';
import { OverlappingFieldsCanBeMerged } from 'graphql/validation/rules/OverlappingFieldsCanBeMerged';
// <😷>
// Hack graphql-js to prevent "conflict because they return conflicting types"
const index = specifiedRules.findIndex(
item => item === OverlappingFieldsCanBeMerged
);
specifiedRules.splice(index, 1);
// </😷> |
Types on the same union are expected to have matching nullability constraints even when the fragments can never converge.
Given this schema:
and this operation:
The execution results in a validation error:
Related issue: #53
Repro script:
node test.js
test.js
package-lock.json
The text was updated successfully, but these errors were encountered: