Skip to content

Commit 20fb2f7

Browse files
committed
Editorial
1 parent b025653 commit 20fb2f7

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

spec/Section 2 -- Language.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,10 +1251,15 @@ avoiding costly string building in clients at runtime.
12511251
If not defined as constant (for example, in {DefaultValue}), a {Variable} can be
12521252
supplied for an input value.
12531253

1254-
Variables must be defined at the top of an operation and are in scope throughout
1255-
the execution of that operation. Values for those variables are provided to a
1256-
GraphQL service as part of a request so they may be substituted in during
1257-
execution.
1254+
:: An _operation variable_ is a variable defined at the top of an operation. An
1255+
operation variable is in scope throughout the execution of that operation.
1256+
Values for operation variables are provided to a GraphQL service as part of a
1257+
request so they may be substituted in during execution.
1258+
1259+
:: A _fragment variable_ is a variable defined on a fragment. A fragment
1260+
variable is locally scoped, it may only be referenced within that fragment
1261+
(non-transitively). Values for fragment variables are provided to fragment
1262+
spreads.
12581263

12591264
In this example, we want to fetch a profile picture size based on the size of a
12601265
particular device:
@@ -1283,23 +1288,16 @@ size `60`:
12831288

12841289
**Variable Use Within Fragments**
12851290

1286-
Variables can be used within fragments.
1287-
1288-
:: An _operation variable_ is a variable defined on an operation. An operation
1289-
variable has global scope within that operation, including within any fragments
1290-
that operation transitively consumes.
1291-
1292-
:: A _fragment variable_ is a variable defined on a fragment. A fragment
1293-
variable is locally scoped, it may only be referenced within that fragment
1294-
(non-transitively).
1295-
1296-
A variable used within a fragment must either be defined by that fragment, or
1297-
must be declared in each top-level operation that transitively consumes that
1298-
fragment. If a variable referenced in a fragment is defined in both the fragment
1299-
and the operation, the fragment definition will be used. If a variable is
1300-
referenced in a fragment and is not defined by that fragment, then any operation
1301-
that transitively references the fragment and does not define that variable is
1302-
invalid (see [All Variable Uses Defined](#sec-All-Variable-Uses-Defined)).
1291+
Variables can be used within fragments. An _operation variable_ has global scope
1292+
within that operation, including within any fragments that operation
1293+
transitively consumes. A variable used within a fragment must either be defined
1294+
by that fragment, or must be declared in each top-level operation that
1295+
transitively consumes that fragment. If a variable referenced in a fragment is
1296+
defined in both the fragment and the operation, the fragment definition will be
1297+
used. If a variable is referenced in a fragment and is not defined by that
1298+
fragment, then any operation that transitively references the fragment and does
1299+
not define that variable is invalid (see
1300+
[All Variable Uses Defined](#sec-All-Variable-Uses-Defined)).
13031301

13041302
## Fragment Variable Definitions
13051303

@@ -1351,11 +1349,11 @@ fragment dynamicProfilePic($size: Int!) on User {
13511349
}
13521350
```
13531351

1354-
The profilePic for `user` will be determined by the variables set by the
1355-
operation, while `secondUser` will always have a `profilePic` of size `10`. In
1356-
this case, the fragment `variableProfilePic` uses the _operation variable_,
1357-
while `dynamicProfilePic` uses the value passed in via the fragment spread's
1358-
`size` argument.
1352+
In the example above, the profilePic for `user` will be determined by the
1353+
variables set by the operation, while `secondUser` will always have a
1354+
`profilePic` of size `10`. In this case, the fragment `variableProfilePic` uses
1355+
the value of the _operation variable_, while `dynamicProfilePic` uses the value
1356+
of the _fragment variable_ passed in via the fragment spread's `size` argument.
13591357

13601358
## Type References
13611359

0 commit comments

Comments
 (0)