where the value submitted to the GraphQL Float variable is interpreted in Java as a Double.
Similar to what was addressed in https://github.com/smallrye/smallrye-graphql/pull/1999 for Long and https://github.com/smallrye/smallrye-graphql/pull/1710 for Boolean, RequestImpl method _formatJsonVariables does not contain a condition for handling Doubles, so the value falls through to an attempt to convert to JsonStructure, which causes an ignored exception. The value is never set in a variable and thus the GraphQL server, upon receiving the request, ends up with a null value for the variable, which could cause incorrect behavior for a nullable variable or an error from the GraphQL server if the variable marked non-null.
Handling Double should cover support for the Float scalar, since GraphQL spec defines it as a signed double precision floating point number. I've added a condition to _formatJsonVariables to handle Double instances so that they are assigned to the variable in the constructed JSON and included with the request as expected, and updated the primitive types test in RequestImplTest to include a Double example (I also added a Long example to the test to cover the use case that was addressed in #1999).
This addresses an issue in executing GraphQL queries with defined variables of the Float scalar, e.g.
where the value submitted to the GraphQL Float variable is interpreted in Java as a Double.
Similar to what was addressed in https://github.com/smallrye/smallrye-graphql/pull/1999 for Long and https://github.com/smallrye/smallrye-graphql/pull/1710 for Boolean, RequestImpl method
_formatJsonVariables
does not contain a condition for handling Doubles, so the value falls through to an attempt to convert to JsonStructure, which causes an ignored exception. The value is never set in a variable and thus the GraphQL server, upon receiving the request, ends up with anull
value for the variable, which could cause incorrect behavior for a nullable variable or an error from the GraphQL server if the variable marked non-null.Handling Double should cover support for the Float scalar, since GraphQL spec defines it as a signed double precision floating point number. I've added a condition to
_formatJsonVariables
to handle Double instances so that they are assigned to the variable in the constructed JSON and included with the request as expected, and updated the primitive types test in RequestImplTest to include a Double example (I also added a Long example to the test to cover the use case that was addressed in #1999).