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