-
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
Grammar should have single root node #1031
Comments
Unfortunately this suggestion would make the grammar ambiguous. Since every type Query {
i: Int
} could be parsed according to your grammar as Rather than thinking of these as 4 alternative "root nodes", you should note that there is exactly one root node: Some examples: Example 1type Query {
i: Int
}
query Q {
__typename
} This document is a Example 2query Q {
__typename
} This document is a Example 3type Query {
i: Int
} This document is a Example 4type Query {
i: Int
}
extend type Query {
f: Float
} This document is a I hope this helps :) |
Thanks for taking the time to answer.
According to the grammar,
Right, it could be parsed going down either of these trees, hence it could be either of these documents.
According to the grammar, there are four nodes which don't have a parent node, hence there are four root nodes.
This may be the desire, which is also implied in the naming, but the grammar doesn't reflect that. According to the grammar, |
Currently, the GraphQL grammar defines four root nodes that don't have a parent node:
Document
, anExecutableDocument
, aTypeSystemDocument
and aTypeSystemExtensionDocument
.Lacking a unique root node makes the spec ambiguous, as it could refer to any of the four grammars defined by these four root nodes.
The grammar should be explicitly defined by introducing a single wrapping root node like
Allowing services to support some documents and not others doesn't need to come at the cost of an ambiguous grammar. It can instead be defined in accompanying prose.
The text was updated successfully, but these errors were encountered: