Skip to content

Commit 87a0d80

Browse files
matprecleebyron
authored andcommitted
Fix: Leaf Field Selections for enums must also be empty (#452)
* Fix: Leaf Field Selections for enums must also be empty * Expand leaf field selection explanatory text for enums * Smoother phrasing
1 parent 6030017 commit 87a0d80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spec/Section 5 -- Validation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,14 @@ fragment conflictingDifferingResponses on Pet {
563563

564564
* For each {selection} in the document
565565
* Let {selectionType} be the result type of {selection}
566-
* If {selectionType} is a scalar:
566+
* If {selectionType} is a scalar or enum:
567567
* The subselection set of that selection must be empty
568568
* If {selectionType} is an interface, union, or object
569569
* The subselection set of that selection must NOT BE empty
570570

571571
**Explanatory Text**
572572

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

576576
The following is valid.
@@ -584,15 +584,15 @@ fragment scalarSelection on Dog {
584584
The following is invalid.
585585

586586
```graphql counter-example
587-
fragment scalarSelectionsNotAllowedOnBoolean on Dog {
587+
fragment scalarSelectionsNotAllowedOnInt on Dog {
588588
barkVolume {
589589
sinceWhen
590590
}
591591
}
592592
```
593593

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

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

0 commit comments

Comments
 (0)