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

astFromValue - JavaScript BigInt support #4088

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ardatan
Copy link
Member

@ardatan ardatan commented May 8, 2024

This PR adds support for BigInt values to astFromValue.
It coerces whenever possible instead of failing.
This will also allow custom scalars like https://the-guild.dev/graphql/scalars/docs/scalars/big-int to get a BigInt as a default value. Similar to #4085

Copy link

netlify bot commented May 8, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit d81c560
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/663d1d20b8d60d0008eca8f6
😎 Deploy Preview https://deploy-preview-4088--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented May 8, 2024

Hi @ardatan, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

Copy link
Member

@saihaj saihaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ardatan
Copy link
Member Author

ardatan commented May 9, 2024

@saihaj Isn't it for Int scalar type? However, this PR doesn't change that behavior. Int still doesn't support larger integers. This PR just allows to use bigint type of JavaScript just like number and string. So it is not the size of the number but the type of it.
If Int supports 32-bit numeric values in string format, it should allow the same values in bigint format as well right?
Same for ID and `Float but without 32-bit limit.

@ardatan ardatan requested a review from saihaj May 9, 2024 17:16
@saihaj
Copy link
Member

saihaj commented May 9, 2024

@saihaj Isn't it for Int scalar type? However, this PR doesn't change that behavior. Int still doesn't support larger integers. This PR just allows to use bigint type of JavaScript just like number and string. So it is not the size of the number but the type of it. If Int supports 32-bit numeric values in string format, it should allow the same values in bigint format as well right? Same for ID and `Float but without 32-bit limit.

Oh I see what you mean, its like we are coercing 2147483646n as 2147483646 since it is a valid GraphQL Int after all

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.

None yet

2 participants