Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for bigint in ID #3913

Open
vwkd opened this issue Jun 18, 2023 · 1 comment
Open

Support for bigint in ID #3913

vwkd opened this issue Jun 18, 2023 · 1 comment

Comments

@vwkd
Copy link

vwkd commented Jun 18, 2023

It's desirable to represent an ID on the server as a bigint instead of a number.

Currently, the ID scalar type supports serializing number to string, but not bigint.

I'd like to see support for serialization of bigint to string similar to number.

I think it would require changing this code

if (Number.isInteger(coercedValue)) {
return String(coercedValue);
}
to

if (Number.isInteger(coercedValue) || typeof coercedValue == "bigint") { 
  return String(coercedValue); 
}
xonx4l added a commit to xonx4l/graphql-js that referenced this issue Oct 6, 2023
@JoviDeCroock
Copy link
Member

This is correct, the spec supports 128-bit numbers https://spec.graphql.org/draft/#sec-ID

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

No branches or pull requests

3 participants
@JoviDeCroock @vwkd and others