@@ -1873,7 +1873,7 @@ This is because {houseTrainedQueryTwoNotDefined} does not define a variable
1873
1873
${atOtherHomes} but that variable is used by {isHouseTrainedFragment} which is
1874
1874
included in that operation.
1875
1875
1876
- ### All Operation Variables Used
1876
+ ### All Variables Used
1877
1877
1878
1878
** Formal Specification**
1879
1879
@@ -1882,6 +1882,11 @@ included in that operation.
1882
1882
- Each {variable} in {variables} must be used at least once in either the
1883
1883
operation scope itself or any fragment transitively referenced by that
1884
1884
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.
1885
1890
1886
1891
** Explanatory Text**
1887
1892
@@ -1982,24 +1987,8 @@ fragment isHouseTrainedFragment on Dog {
1982
1987
This document is not valid because {queryWithExtraVar} defines an extraneous
1983
1988
variable.
1984
1989
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:
2003
1992
2004
1993
``` graphql counter-example
2005
1994
query queryWithFragmentArgUnused ($atOtherHomes : Boolean ) {
0 commit comments