ipld / ipld/go-ipld-graphql

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

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go Template
Stars
13
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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: https://github.com/ipld/go-ipld-graphql/blob/00e0c87a502c6125cf511cdfbf7c5204e51cd035/gen/tmpl/struct.tmpl#L9

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.