Open bishnoisnb29 opened 6 months ago
I am having similar troubles serializing and deserializing java.time.YearMonth and org.joda.money.Money.
Is there any update on this topic?
EDIT: It would be very nice to just register (or pass through) a class to handle the de/serialization, for example jakarta.json.bind.Jsonb
Issue Description
The current implementation of the
InputValueSerializer
in the DGS Codegen library does not support custom serialization forDate
fields. This limitation makes it challenging to handleDate
objects properly when constructing GraphQL queries, especially when dates need to be serialized to ISO 8601 format.Steps to Reproduce
Date
fields in the input.GraphQLQueryRequest.serialize()
.Date
fields are not converted to ISO 8601 format.Expected Behavior
The
InputValueSerializer
should provide a way to handle custom serialization forDate
fields, allowing dates to be converted to ISO 8601 strings during the serialization process.Current Workaround
Currently, users need to preprocess the input map manually before creating the
GraphQLQueryRequest
. This involves traversing the input map and convertingDate
objects to ISO 8601 strings using a utility method. While effective, this approach adds additional complexity and is not ideal.Example of the Current Workaround
Proposed Solution
Enhance the
InputValueSerializer
to support custom serializers for specific types, includingDate
. This could be achieved by allowing users to register custom serializers for different classes, which would then be used during the serialization process.Additional Context
Adding support for custom serializers will improve the flexibility and usability of the DGS Codegen library, making it easier to work with various data types, including
Date
, in a more seamless and intuitive manner.