You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Even though it has been discussed here and here about the use of GSON and the way it converts integers to double by treating them as numbers, and the work arounds to use LenientNumericalScalars, we have come across potentially 2 issues with how GraphQL Java handles them.
any string (such as "4") or integer (such as 4) input value should be coerced to ID as appropriate for the ID formats a given GraphQL server expects. Any other input value, including float input values (such as 4.0), must raise a query error indicating an incorrect type.
The 2 potential issues I see are:
When a Double reaches GraphqlIDCoercing.parseValue, it is converted to a string and accepted rather than being rejected with CoercingParseValueException (whether this is because of GSON or not, it doesn't seem to get stopped before reaching here and will enter the execution as a String ending .0) - This may be me taking the above line from the spec too literally.
With how GSON treats integers as Numbers, should the GraphqlIDCoercing class be able to handle integers that have come in as Double due to following how JS and Numbers work. Obviously for custom scalars this can be avoided, but is this something that should be natively handled for IDs. If not, should the docs be updated to include a recommended solution of overriding the default behaviour.
To Reproduce
Pass a value in with a .0 on the end for an ID field as a variable and you will receive a string version of that value but with .0 at the end. If you do the same with an actual double e.g. 3.5, you will get that as a string in the execution.
The text was updated successfully, but these errors were encountered:
Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.
Describe the bug
Even though it has been discussed here and here about the use of GSON and the way it converts integers to double by treating them as numbers, and the work arounds to use LenientNumericalScalars, we have come across potentially 2 issues with how GraphQL Java handles them.
According to the GraphQL spec for id fields,
The 2 potential issues I see are:
To Reproduce
Pass a value in with a .0 on the end for an ID field as a variable and you will receive a string version of that value but with .0 at the end. If you do the same with an actual double e.g. 3.5, you will get that as a string in the execution.
The text was updated successfully, but these errors were encountered: