@@ -1216,9 +1216,9 @@ size `60`:
1216
1216
** Variable Use Within Fragments**
1217
1217
1218
1218
Variables can be used within fragments. Operation-defined variables have global
1219
- scope with a given operation. Fragment-defined variables have local scope within the
1220
- fragment definition they are defined in . A variable used within a fragment must either
1221
- be declared in any top-level operation that transitively consumes that fragment,
1219
+ scope within a given operation. Fragment-defined variables have local scope within the
1220
+ fragment definition in which they are defined. A variable used within a fragment must either
1221
+ be declared in each top-level operation that transitively consumes that fragment,
1222
1222
or by that same fragment as a fragment variable definition. If a variable
1223
1223
referenced in a fragment is included by an operation where neither the fragment
1224
1224
nor the operation defines that variable, that operation is invalid (see
@@ -1233,7 +1233,7 @@ For example, the profile picture may need to be a different size depending on
1233
1233
the parent context:
1234
1234
1235
1235
``` graphql example
1236
- query withFragmentArguments {
1236
+ query userAndFriends {
1237
1237
user (id : 4 ) {
1238
1238
... dynamicProfilePic (size : 100 )
1239
1239
friends (first : 10 ) {
@@ -1256,7 +1256,7 @@ A fragment-defined variable is scoped to the fragment that defines it.
1256
1256
Fragment-defined variables are allowed to shadow operation-defined variables.
1257
1257
1258
1258
``` graphql example
1259
- query withShadowedVariables ($size : Int ) {
1259
+ query withShadowedVariables ($size : Int ! ) {
1260
1260
user (id : 4 ) {
1261
1261
... variableProfilePic
1262
1262
}
@@ -1275,10 +1275,10 @@ fragment dynamicProfilePic($size: Int!) on User {
1275
1275
```
1276
1276
1277
1277
The profilePic for ` user ` will be determined by the variables set by the
1278
- operation, while ` secondUser ` will always have a profilePic of size 10 . In this
1278
+ operation, while ` secondUser ` will always have a ` profilePic ` of size ` 10 ` . In this
1279
1279
case, the fragment ` variableProfilePic ` uses the operation-defined variable,
1280
1280
while ` dynamicProfilePic ` uses the value passed in via the fragment spread's
1281
- argument ` size ` .
1281
+ ` size ` argument .
1282
1282
1283
1283
## Type References
1284
1284
0 commit comments