Issues with response serialization #1742
Replies: 4 comments 3 replies
|
Hello, I'm trying to do the same but it doesn't work for me. |
|
Hi @cesar05 no I don't have any additional information. Maybe we should file an issue as this got no traction. |
|
If you're calling using a In short, there is no way to control what is returned in the data property directly. For Scalar types, you can control things via a Coercing implementation registered as a bean. If your GraphQL schema doesn't match what your pojo looks like, you need to register a custom |
|
JSON / Jackson serialization is not involved here at all. If your schema field name diverges from the getter name of your POJO, you need to register a custom DataFetcher (see the graphql-java docs here). By default, graphql-java will try to find a getter that matches the name in the schema. Here's a solution from a similar reported issue. |
Uh oh!
There was an error while loading. Please reload this page.
Hello, I'm a little unclear about how to go about using Jackson to serialize objects. I have an annotated POJO:
and am invoking GraphQL through the DGS framework:
The
dataproperty that I get back is anObjecttypedLinkedHashMapthat does not appear to have followed the Jackson annotations:It appears that something has per-emptively changed the type to
LinkedHashMapsprior to running Jackson serialization, resulting in the actual field names, not the annotated JSON properties.If I manually serialize it I get the expected result (the property obeys the
@JsonPropertyannotation):I tried to override the
ObjectMapperbut I still see the same behavior.All reactions