Skip to content

Commit

Permalink
Apply Benjie's suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Benjie <[email protected]>
  • Loading branch information
JoviDeCroock and benjie authored Mar 27, 2024
1 parent 78b5c56 commit 7cad383
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -1216,9 +1216,9 @@ size `60`:
**Variable Use Within Fragments**

Variables can be used within fragments. Operation-defined variables have global
scope with a given operation. Fragment-defined variables have local scope within the
fragment definition they are defined in. A variable used within a fragment must either
be declared in any top-level operation that transitively consumes that fragment,
scope within a given operation. Fragment-defined variables have local scope within the
fragment definition in which they are defined. A variable used within a fragment must either
be declared in each top-level operation that transitively consumes that fragment,
or by that same fragment as a fragment variable definition. If a variable
referenced in a fragment is included by an operation where neither the fragment
nor the operation defines that variable, that operation is invalid (see
Expand All @@ -1233,7 +1233,7 @@ For example, the profile picture may need to be a different size depending on
the parent context:

```graphql example
query withFragmentArguments {
query userAndFriends {
user(id: 4) {
...dynamicProfilePic(size: 100)
friends(first: 10) {
Expand All @@ -1256,7 +1256,7 @@ A fragment-defined variable is scoped to the fragment that defines it.
Fragment-defined variables are allowed to shadow operation-defined variables.

```graphql example
query withShadowedVariables($size: Int) {
query withShadowedVariables($size: Int!) {
user(id: 4) {
...variableProfilePic
}
Expand All @@ -1275,10 +1275,10 @@ fragment dynamicProfilePic($size: Int!) on User {
```

The profilePic for `user` will be determined by the variables set by the
operation, while `secondUser` will always have a profilePic of size 10. In this
operation, while `secondUser` will always have a `profilePic` of size `10`. In this
case, the fragment `variableProfilePic` uses the operation-defined variable,
while `dynamicProfilePic` uses the value passed in via the fragment spread's
argument `size`.
`size` argument.

## Type References

Expand Down

0 comments on commit 7cad383

Please sign in to comment.