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
When a Graphql server tries to return a special float value(NaN or one of the Infinites), it fails with the exception "Expected type 'Float' but was 'Float'."
Make the wiring return Float.NaN, Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY for this field
Start the server and query the field from a client
Expected result: some data is received
Actual result: Error with message "Can't serialize value (/${fieldname}) : Expected type 'Float' but was 'Float'."
Extra
Java 8
Also, it looks like the cause of the bug lies in the GraphQL java library, which uses BigDecimal for serialization of float values. And according to its documentation, BigDecimal is unable to handle NaN and ±Infinity.
The text was updated successfully, but these errors were encountered:
@tsegismont it looks like they already have issues for NaNs (graphql-java/graphql-java#1062) and for infinities (graphql-java/graphql-java#1998). If I understand correctly, the implementation was created before the specification was updated to describe a proper handling of NaNs.
As a side note, there is an ongoing proposal to remove NaNs and Infinities from the specification: graphql/graphql-spec/pull/780
Version
3.9.5
Context
When a Graphql server tries to return a special float value(NaN or one of the Infinites), it fails with the exception "Expected type 'Float' but was 'Float'."
Do you have a reproducer?
https://github.com/vert-x3/vertx-web/blob/907f4d638a01c00bcb71465c25d79094986204d3/vertx-web-graphql/src/test/java/io/vertx/ext/web/handler/graphql/ReproduceServer.java
Steps to reproduce
Expected result: some data is received
Actual result: Error with message "Can't serialize value (/${fieldname}) : Expected type 'Float' but was 'Float'."
Extra
Java 8
Also, it looks like the cause of the bug lies in the GraphQL java library, which uses BigDecimal for serialization of float values. And according to its documentation, BigDecimal is unable to handle NaN and ±Infinity.
The text was updated successfully, but these errors were encountered: