-
Notifications
You must be signed in to change notification settings - Fork 222
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
LongType doesn't support incoming String values #1162
Comments
Thanks for the issue and the PR! |
According to the latest spec services that specify custom scalars should include the However, I don't know if Sangria currently supports that annotation? W.r.t coercion it is up to the implementor to define what are reasonable rules so long as they are performed without losing precision (if I'm reading the spec correctly) |
According to this announcement you can contribute your custom scalars, though given that the announcement is almost 2 years old and there are no new contributions by the community since then, it might not really have taken hold as an idea |
Your issue is about input coercion right? https://spec.graphql.org/October2021/#sec-Scalars.Input-Coercion What you mentioned before is not the same:
This is for example if the field is a I assume you're having this issue with a real-world case. Out of curiosity, can you provide more details, like which JavaScript library is used? |
Input coercion for the scalar
|
We do indeed have issues with a real-world case. |
I understand your pain, and that there's no easy fix without touching sangria. |
Which part of the spec for custom Scalars do you see this breaking? The spec specifically notes that the built-in |
Yes that would be nice. In the meantime, I guess that your point about using string is adequate to this part of the spec yes:
|
Under the assumption that most consumers of the GraphQL schema specified by Sangria is running in JavaScript it seems prudent to allow input coercion from
String
for theLong
scalar type, as JavaScript has no way of precisely representing the full spectrum using it'snumber
data type.I.e. given the following schema
then the following payload should be accepted
The text was updated successfully, but these errors were encountered: