-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Statement about truncating fractional values wrong? #312
Comments
As far as I understood, the section of the spec you are quoting describes the output coercion. In this issue, I only touched on the input value coercion. I see these two as separate sets of rules. Input coercion is very strict where output coercion is more a hint to server implementers which only requires producing type-compliant literal regardless or the internal server representation of this scalar value. (though I would prefer to make these hints more strict and recommend to raise an error in case of |
Mhh ... not sure I can follow you: result coercion (= output coercion) is Both are implement the same way: Does this mean the ref. impl is still wrong and should truncate the value for |
This is a very good point! TBH, I was also a bit confused before when I saw that Though I wouldn't say that graphql-js is not spec-compliant here. Spec doesn't say that if developer returns a
I guess it comes back to a definition of |
ok ... so the implementation of |
At least this is how I understand it :) Assuming that it is possible to return values other than |
After thinking more about it: Input coercion in the spec is actually two aspects: Input as literal (implement as But this is not always clearly communicated: for example in the Int section about "Input coercion" there is only specified what should happen with literals. But above in the general section about "Input coercion" it is dealt with "Input as variable":
This means I think the spec could more clearer and distinguish more between the two different kinds of "Input coercion". |
This edits the "result coercion" section of the scalar types to make it clear that data loss is to be avoided and suggests that internal values of the correct type are the ideal scenario. Fixes #312
This edits the "result coercion" section of the scalar types to make it clear that data loss is to be avoided and suggests that internal values of the correct type are the ideal scenario. Fixes #312
This edits the "result coercion" section of the scalar types to make it clear that data loss is to be avoided and suggests that internal values of the correct type are the ideal scenario. Fixes #312
This edits the "result coercion" section of the scalar types to make it clear that data loss is to be avoided and suggests that internal values of the correct type are the ideal scenario. Fixes #312
In the section about scalars: (https://github.com/facebook/graphql/blob/master/spec/Section%203%20--%20Type%20System.md#scalars)
there is the following statement:
This seems contradictory to this Issue: graphql/graphql-js#827, where it was cleared that fractions should not be truncated.
The text was updated successfully, but these errors were encountered: