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

Allow for serializing int as BigInt #4223

Closed
wants to merge 1 commit into from
Closed

Conversation

JoviDeCroock
Copy link
Member

Fixes #3913

In the spec we say that we allow for BigInt as an ID value in here. However in JS we don't support serializing a response value from BigInt to String.

@JoviDeCroock JoviDeCroock requested a review from a team as a code owner October 11, 2024 07:18
Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit 1318fa5
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/6709121001ee6700088d885e
😎 Deploy Preview https://deploy-preview-4223--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

Hi @JoviDeCroock, 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

@JoviDeCroock JoviDeCroock added the PR: bug fix 🐞 requires increase of "patch" version number label Oct 11, 2024
@yaacovCR
Copy link
Contributor

How does this compare to #4088 ?

@JoviDeCroock
Copy link
Member Author

JoviDeCroock commented Oct 11, 2024

@yaacovCR #4088 adds full support to Int/... for BigInt however that isn't really specced out compared to ID which explicitly in the spec states BigInt support.

Int stating only 32bit can be seen here and there in astFromValue we seem to return kind.INT for a bigint

@yaacovCR
Copy link
Contributor

Maybe #3109 then? I had closed the earlier PRs in favor of the more comprehensive, but that could have been the less optimal approach.

@JoviDeCroock
Copy link
Member Author

That is indeed similar, that only gets applied to serialize not parseValue, I can add a co-authored-by though as they do deserve credit for this. Thank you for making me aware of this PR, it wasn't linked to the issue so I did not find it

@yaacovCR
Copy link
Contributor

However in JS we don't support serializing a response value from BigInt to String.

Did you mean ID here?

Did we want to support String as well?

@JoviDeCroock
Copy link
Member Author

JoviDeCroock commented Oct 11, 2024

I meant what it reads, a JS value of type BigInt needs to get transformed to a string, just like we do for Int.

i.e. when my resolver returns { id: BigInt(123) } we need to cast it to "123" which is stated in the spec. https://spec.graphql.org/draft/#sel-FAHXZDCCuCCEBsnL

@yaacovCR
Copy link
Contributor

Now I understand your description better… but I still wonder now that we have opened the bigint box whether we can support it with regards to our string scalar. it would certainly be reasonable to make that a separate PR.

@JoviDeCroock JoviDeCroock deleted the serialize-bigint-id branch October 18, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bug fix 🐞 requires increase of "patch" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants