You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
building on prior work:
- #3109
- #3973
- #4088
- #4223
- #4276
This PR adds bigint support to:
- GraphQLInt, including input/output coercion, throwing if out of
bounds, and new default value programmatic default value to literal
- GraphQLFloat, including input/output coercion, throwing if cannot be
represented, including with any loss of precision.
- GraphQLString, output coercion only, like number
- GraphQLBoolean, output coercion only, like number
- GraphQLID, output and input coercion, in parallel to number, and new
default value programmatic default value to literal
Also, for custom scalars:
- updates the `defaultScalarValueToLiteral` to convert a `bigint` to an
Int literal
- updates for deprecated `astFromValue` for passthrough custom scalars,
i.e. scalars that return `bigint` from coerceOutputValue/serialize, to
convert `bigint` to an Int literal.
cf. also #3913
Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
Co-authored-by: jdecroock <decroockjovi@gmail.com>
Co-authored-by: Hkmu <3169251+hkmu@users.noreply.github.com>
Co-authored-by: xonx <119700621+xonx4l@users.noreply.github.com>
'Float cannot represent non numeric value: 9007199254740993 (value would lose precision)',
230
+
);
231
+
expect(()=>coerceInputValue(2n**1024n)).to.throw(
232
+
'Float cannot represent non numeric value: 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 (value is too large)',
233
+
);
206
234
207
235
expect(()=>coerceInputValue(undefined)).to.throw(
208
236
'Float cannot represent non numeric value: undefined',
'Float cannot represent non numeric value: 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 (value is too large)',
341
+
);
304
342
expect(()=>coerceOutputValue('one')).to.throw(
305
343
'Float cannot represent non numeric value: "one"',
'Float cannot represent non numeric value: 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 (value is too large)',
0 commit comments