-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add 5.2.4 Operation Type Exists #1098
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find!
Co-authored-by: Benjie <benjie@jemjie.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though some slight editorial on the wording to match the style of the spec as a whole might be warranted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great validation rule 🙌
The lack of this validation rule can be demonstrated in GraphQL.js with this: import { GraphQLSchema, GraphQLInt, graphql, GraphQLObjectType } from 'graphql';
const Query = new GraphQLObjectType({
name: 'Query',
fields: {
a: {
type: GraphQLInt,
resolve() {
return 42;
},
},
},
});
const schema = new GraphQLSchema({
query: Query,
});
const result = await graphql({ schema, source: `mutation { __typename }` });
console.dir(result); which produces:
We should really mark this as an invalid request, and thus it should not have a |
This is a refresh of #955 which has a pending PR at the implementation graphql/graphql-js#3601 |
New Spec PR: graphql/graphql-spec#1098 Old Spec PR: graphql/graphql-spec#947 Original issue raised by @benjaminjkraft : #3592
Closes #1097