Skip to content

Commit 8a8f9dc

Browse files
committed
Update CompleteValue() to not return early for NaN
1 parent 64321d5 commit 8a8f9dc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

spec/Section 3 -- Type System.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ encoding integer numbers larger than 32-bit.
451451
### Float
452452

453453
The Float scalar type represents signed double-precision finite (i.e., not {NaN}
454-
or {Infinity}) fractional values as specified by
454+
or {Infinity}) fractional values as specified by
455455
[IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point). Response formats
456456
that support an appropriate double-precision number type should use that type to
457457
represent this scalar.
@@ -466,14 +466,17 @@ reasonable without losing information, otherwise they must raise a field error.
466466
Examples of this may include returning `1.0` for the integer number `1`, or
467467
`123.0` for the string `"123"`.
468468

469+
Non-finite floating-point internal values ({NaN} and {Infinity}) cannot be
470+
coerced to {Float} and must raise a field error.
471+
469472
**Input Coercion**
470473

471474
When expected as an input type, both integer and float input values are
472475
accepted. Integer input values are coerced to Float by adding an empty
473476
fractional part, for example `1.0` for the integer input value `1`. All
474477
other input values, including strings with numeric content, must raise a query
475478
error indicating an incorrect type. If the integer input value represents a
476-
value not representable by IEEE 754, a query error should be raised.
479+
value not representable by finite IEEE 754, a query error should be raised.
477480

478481

479482
### String

spec/Section 6 -- Execution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ CompleteValue(fieldType, fields, result, variableValues):
648648
* If {completedResult} is {null}, throw a field error.
649649
* Return {completedResult}.
650650
* If {result} is {null} (or another internal value similar to {null} such as
651-
{undefined} or {NaN}), return {null}.
651+
{undefined}), return {null}.
652652
* If {fieldType} is a List type:
653653
* If {result} is not a collection of values, throw a field error.
654654
* Let {innerType} be the inner type of {fieldType}.
@@ -657,7 +657,7 @@ CompleteValue(fieldType, fields, result, variableValues):
657657
{resultItem} is each item in {result}.
658658
* If {fieldType} is a Scalar or Enum type:
659659
* Return the result of "coercing" {result}, ensuring it is a legal value of
660-
{fieldType}, otherwise {null}.
660+
{fieldType}, otherwise throw a field error.
661661
* If {fieldType} is an Object, Interface, or Union type:
662662
* If {fieldType} is an Object type.
663663
* Let {objectType} be {fieldType}.

0 commit comments

Comments
 (0)