Skip to content

Commit

Permalink
Move the infinite loop coercion check to defaultValue validation
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Nov 25, 2020
1 parent 9165c89 commit 62b7bb2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,9 @@ of rules must be adhered to by every Object type in a GraphQL schema.
characters {"__"} (two underscores).
2. The argument must accept a type where {IsInputType(argumentType)}
returns {true}.
3. If specified, {defaultValue} must be compatible with {argumentType}
as per the coercion rules for that type.
3. If specified, {defaultValue} must be compatible with {argumentType} as
per the coercion rules for that type, and coercion of {defaultValue}
must not cause an infinite loop.
3. An object type may declare that it implements one or more unique interfaces.
4. An object type must be a super-set of all interfaces it implements:
1. Let this object type be {objectType}.
Expand Down Expand Up @@ -1469,8 +1470,7 @@ is constructed with the following rules:

* If no value is provided for a defined input object field and that field
definition provides a default value, the result of coercing the default value
according to the coercion rules of the input field type should be used (if
this coercion would cause an infinite loop, a query error should be thrown).
according to the coercion rules of the input field type should be used.
If no default value is provided and the input object field's type is
non-null, an error should be thrown. Otherwise, if the field is not required,
then no entry is added to the coerced unordered map.
Expand Down Expand Up @@ -1531,7 +1531,8 @@ Literal Value | Variables | Coerced Value
3. The input field must accept a type where {IsInputType(inputFieldType)}
returns {true}.
4. If specified, {defaultValue} must be compatible with {inputFieldType} as
per the coercion rules for that type.
per the coercion rules for that type, and coercion of {defaultValue} must
not cause an infinite loop.


### Input Object Extensions
Expand Down

0 comments on commit 62b7bb2

Please sign in to comment.