Deserialisation exception from GraphQLResponse.from
Hi,
we are using http4k with the GraphQL-java library and experience some malfunction while transforming ExecutionResult to GraphQLResponse using GraphQLResponse.from. The exception reads as this:
Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('graphql.execution.NonNullableValueCoercedAsNullException:...
Looking into the issue, it seems that ExecutionResult can be populated by the GraphQL-Java lib with errors that both implement GraphQLError and extend GraphQLException (one example is the above-mentioned NonNullableValueCoercedAsNullException). This is causing the exception because in the GraphQLResponse.from method there is a serialization deserialization cycle using ConfigurableJackson which by default seralize Throwables as String (link) and that String cannot be deserialized back to a Map.
I found some workarounds to prevent this issue (configuring a custom JSON marshaller; not using GraphQLResponse.from; or using ExecutionResult::toSpecification based on graphql-java's documentation) but maybe there are some better solutions for it you are aware of or a bugfix is necessary.
Versions: http4k: 4.33.1.0 graphql-java: 19.2