Skip to content

Commit da7743e

Browse files
committed
validation suggestions
1 parent 5c3f996 commit da7743e

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

spec/Section 5 -- Validation.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ This is because {houseTrainedQueryTwoNotDefined} does not define a variable
18731873
${atOtherHomes} but that variable is used by {isHouseTrainedFragment} which is
18741874
included in that operation.
18751875

1876-
### All Operation Variables Used
1876+
### All Variables Used
18771877

18781878
**Formal Specification**
18791879

@@ -1882,6 +1882,11 @@ included in that operation.
18821882
- Each {variable} in {variables} must be used at least once in either the
18831883
operation scope itself or any fragment transitively referenced by that
18841884
operation, excluding fragments that define the same name as an argument.
1885+
- For every {fragment} in the document:
1886+
- Let {variables} be the variables defined by that {fragment}.
1887+
- Each {variable} in {variables} must be used at least once transitively
1888+
within the fragment's selection set excluding traversal of named fragment
1889+
spreads.
18851890

18861891
**Explanatory Text**
18871892

@@ -1982,24 +1987,8 @@ fragment isHouseTrainedFragment on Dog {
19821987
This document is not valid because {queryWithExtraVar} defines an extraneous
19831988
variable.
19841989

1985-
### All Fragment Variables Used
1986-
1987-
**Formal Specification**
1988-
1989-
- For every {fragment} in the document:
1990-
- Let {variables} be the variables defined by that {fragment}.
1991-
- Each {variable} in {variables} must be used at least once transitively
1992-
within the fragment's selection set excluding traversal of named fragment
1993-
spreads.
1994-
1995-
**Explanatory Text**
1996-
1997-
All variables defined by a fragment must be used in that same fragment. Because
1998-
fragment-defined variables are scoped to the fragment they are defined on, if
1999-
the fragment does not use the variable, then the variable definition is
2000-
superfluous.
2001-
2002-
For example, the following is invalid:
1990+
Fragment variables must also be used within their definitions. For example, the
1991+
following is invalid:
20031992

20041993
```graphql counter-example
20051994
query queryWithFragmentArgUnused($atOtherHomes: Boolean) {

0 commit comments

Comments
 (0)