Skip to content

Commit cf0f3ee

Browse files
committed
Add note about nullable variables with default values
1 parent 7e13d5c commit cf0f3ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spec/Section 6 -- Execution.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,13 @@ Note: Variable values are not coerced because they are expected to be coerced
639639
before executing the operation in {CoerceVariableValues()}, and valid operations
640640
must only allow usage of variables of appropriate types.
641641

642+
Note: When a default value exists for a variable definition, the type of the
643+
variable is allowed to be nullable even if it is used in a non-nullable
644+
position, see
645+
[Allowing Optional Variables When Default Values Exist](#sec-All-Variable-Usages-Are-Allowed.Allowing-Optional-Variables-When-Default-Values-Exist)
646+
in Validation. If the value for a variable is explicitly {null} and is used in a
647+
non-nullable position, a _field error_ will be raised.
648+
642649
### Value Resolution
643650

644651
While nearly all of GraphQL execution can be described generically, ultimately

0 commit comments

Comments
 (0)