Skip to content

Commit 62b7bb2

Browse files
committed
Move the infinite loop coercion check to defaultValue validation
1 parent 9165c89 commit 62b7bb2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spec/Section 3 -- Type System.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,9 @@ of rules must be adhered to by every Object type in a GraphQL schema.
818818
characters {"__"} (two underscores).
819819
2. The argument must accept a type where {IsInputType(argumentType)}
820820
returns {true}.
821-
3. If specified, {defaultValue} must be compatible with {argumentType}
822-
as per the coercion rules for that type.
821+
3. If specified, {defaultValue} must be compatible with {argumentType} as
822+
per the coercion rules for that type, and coercion of {defaultValue}
823+
must not cause an infinite loop.
823824
3. An object type may declare that it implements one or more unique interfaces.
824825
4. An object type must be a super-set of all interfaces it implements:
825826
1. Let this object type be {objectType}.
@@ -1469,8 +1470,7 @@ is constructed with the following rules:
14691470

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

15361537

15371538
### Input Object Extensions

0 commit comments

Comments
 (0)