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

use json.Decoder.UseNumber() when unmarshalling vars #248

Merged
merged 1 commit into from
Aug 2, 2018
Merged

Conversation

vektah
Copy link
Collaborator

@vektah vektah commented Aug 2, 2018

The new stricter variable validation rules uncovered a bug where json unmarshalling ints would get converted to floats, then coerced back to ints.

This is obviously a lossy process for large int numbers (52 bit mantissa means numbers up to 4,503,599,627,370,496 should be OK).

I've removed the coercion from float -> int and opted into json.Decoder.UseNumber which keeps all numbers as strings until we go to decode them, giving us back the full 64 bits.

@vektah vektah merged commit 07b7e6c into next Aug 2, 2018
@vektah vektah deleted the json-usenumber branch August 2, 2018 06:41
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
use json.Decoder.UseNumber() when unmarshalling vars
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.

1 participant