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

IPLD Ints are int64, Graphql is int32, any numbers above 2^31 fail to serialize #31

Open
hannahhoward opened this issue Jul 9, 2021 · 0 comments

Comments

@hannahhoward
Copy link

So yay for graphql's spec being extra annoying but:
https://spec.graphql.org/June2018/#sec-Int
specifies integers as having only 32 bit range. (cause something something javascript)

Golangs Graphql deals with this by silently converting these values to nil:
https://github.com/graphql-go/graphql/blob/1a9db8859ef57c2821bbd47b0db9a1a09e617f41/scalars.go#L61

And if the feels aren't optional, they get a NonNull modifier:

Type: graphql.NewNonNull({{ .Type | LocalName }}),

Which then conveniently produces a serialization error.

Easy way to check with the dealbot: Run this query -- https://lb.mainnet-us-east-1.filops.net/mainnet-dealbot-graphql/graphql?query=query%20{%20Tasks%20{All%20{%20StorageTask%20{%20Size%20}%20}}%20} -- all I'm doing is asking for the StorageTasks.Size value

I have no idea what the proper solution is -- make them floats? Custom Scalar? I think at least float will work.

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

1 participant