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

Is there a reason graphql floats do not support Infinity and NaN? #1071

Open
dopry opened this issue Dec 14, 2023 · 3 comments
Open

Is there a reason graphql floats do not support Infinity and NaN? #1071

dopry opened this issue Dec 14, 2023 · 3 comments

Comments

@dopry
Copy link

dopry commented Dec 14, 2023

Is there a reason graphql floats do not support Infinity and NaN? Would a proposal to add infinity and/or NaN be seriously considered?

@benjie
Copy link
Member

benjie commented Dec 15, 2023

Those values are hard to serialise, e.g. they don’t serialise in JSON. GraphQL aims for maximal compatibility and this excludes these kinds of things. However you could create your own custom scalar e.g. IEEE754Float which maybe encodes these special values as a string?

@dopry
Copy link
Author

dopry commented Dec 19, 2023

So if JSON supported serializing +/-Infinity and NaN then this would be something that could be considered?

@dopry
Copy link
Author

dopry commented Dec 19, 2023

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

2 participants