Skip to content

scalars: ID and String support for serializing BigInt#3109

Closed
Hkmu wants to merge 1 commit intographql:mainfrom
Hkmu:scalar-string-bigint
Closed

scalars: ID and String support for serializing BigInt#3109
Hkmu wants to merge 1 commit intographql:mainfrom
Hkmu:scalar-string-bigint

Conversation

@Hkmu
Copy link
Copy Markdown

@Hkmu Hkmu commented May 17, 2021

Add support to serialize BigInt for String and ID scalar.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented May 17, 2021

CLA Signed

The committers are authorized under a signed CLA.

@papandreou
Copy link
Copy Markdown

This would be extremely handy! I'm about to switch to representing ids as bigint in my app, and it results in ID cannot represent a non-string and non-integer value: .... This patch fixes that.

@yaacovCR
Copy link
Copy Markdown
Contributor

yaacovCR commented Oct 1, 2024

I think it would make sense to use a custom scalar for BigInt a la https://the-guild.dev/graphql/scalars/docs/scalars/big-int

@yaacovCR yaacovCR closed this Oct 1, 2024
@yaacovCR
Copy link
Copy Markdown
Contributor

yaacovCR commented Oct 1, 2024

I misunderstood, this is for coercion of values from BigInt to string/id, not to int, this is reasonable, see discussion at newer PR #4088

@yaacovCR yaacovCR mentioned this pull request Feb 4, 2026
yaacovCR added a commit that referenced this pull request Feb 11, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 22, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 22, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 23, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 23, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 24, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 24, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 24, 2026
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>
yaacovCR added a commit that referenced this pull request Feb 24, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants