Skip to content

Commit fa905f1

Browse files
committed
Precision and clarity
1 parent 7ec40df commit fa905f1

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

spec/Section 5 -- Validation.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -962,9 +962,9 @@ fragment multipleArgsReverseOrder on Arguments {
962962

963963
### Argument Uniqueness
964964

965-
Fields, fragment spreads and directives treat arguments as a mapping of argument
966-
name to value. More than one argument with the same name in an argument set is
967-
ambiguous and invalid.
965+
Fields, named fragment spreads and directives treat arguments as a mapping of
966+
argument name to value. More than one argument with the same name in an argument
967+
set is ambiguous and invalid.
968968

969969
**Formal Specification**
970970

@@ -976,17 +976,17 @@ ambiguous and invalid.
976976

977977
### Required Arguments
978978

979-
- For each Field, Fragment Spread or Directive in the document:
980-
- Let {arguments} be the arguments provided by the Field, Directive or
979+
- For each Field, Directive, or Named Fragment Spread in the document:
980+
- Let {arguments} be the arguments provided to the Field, Directive, or Named
981981
Fragment Spread.
982-
- Let {argumentDefinitions} be the set of argument definitions of that Field
983-
or Directive, or the variable definitions of that Fragment.
984-
- For each {argumentDefinition} in {argumentDefinitions}:
985-
- Let {type} be the expected type of {argumentDefinition}.
986-
- Let {defaultValue} be the default value of {argumentDefinition}.
982+
- Let {inputDefinitions} be the set of argument definitions of that Field or
983+
Directive, or the variable definitions of the referenced Fragment.
984+
- For each {inputDefinition} in {inputDefinitions}:
985+
- Let {type} be the expected type of {inputDefinition}.
986+
- Let {defaultValue} be the default value of {inputDefinition}.
987987
- If {type} is Non-Null and {defaultValue} does not exist:
988-
- Let {argumentName} be the name of {argumentDefinition}.
989-
- Let {argument} be the argument in {arguments} named {argumentName}.
988+
- Let {inputName} be the name of {inputDefinition}.
989+
- Let {argument} be the argument in {arguments} named {inputName}.
990990
- {argument} must exist.
991991
- Let {value} be the value of {argument}.
992992
- {value} must not be the {null} literal.
@@ -1035,6 +1035,18 @@ fragment missingRequiredArg on Arguments {
10351035
}
10361036
```
10371037

1038+
Fragment arguments can also be the source of the default value:
1039+
1040+
```graphql example
1041+
fragment fragmentWithDefault($arg: Boolean! = true) on Arguments {
1042+
nonNullBooleanArgField(nonNullBooleanArg: $arg)
1043+
}
1044+
1045+
fragment goodFragmentDefault on Arguments {
1046+
...fragmentWithDefault
1047+
}
1048+
```
1049+
10381050
## Fragments
10391051

10401052
### Fragment Declarations

0 commit comments

Comments
 (0)