Skip to content

Fix: Leaf Field Selections for enums must also be empty #452

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

Merged
merged 3 commits into from
Jun 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,14 +561,14 @@ fragment conflictingDifferingResponses on Pet {

* For each {selection} in the document
* Let {selectionType} be the result type of {selection}
* If {selectionType} is a scalar:
* If {selectionType} is a scalar or enum:
* The subselection set of that selection must be empty
* If {selectionType} is an interface, union, or object
* The subselection set of that selection must NOT BE empty

**Explanatory Text**

Field selections on scalars are never allowed: scalars
Field selections on scalars or enums are never allowed, because they
are the leaf nodes of any GraphQL query.

The following is valid.
Expand All @@ -582,15 +582,15 @@ fragment scalarSelection on Dog {
The following is invalid.

```graphql counter-example
fragment scalarSelectionsNotAllowedOnBoolean on Dog {
fragment scalarSelectionsNotAllowedOnInt on Dog {
barkVolume {
sinceWhen
}
}
```

Conversely the leaf field selections of GraphQL queries
must be scalars. Leaf selections on objects, interfaces,
must be of type scalar or enum. Leaf selections on objects, interfaces,
and unions without subfields are disallowed.

Let's assume the following additions to the query root type of the schema:
Expand Down