Yes of course, I agree with you that serializing LocalDates as arrays is
not a good idea! But, are you sure that GSON didn't convert LocalDate to
format arrays dates ?

Just let's check it in our configuration GSON builder
as GoogleGsonSerializerHelper -> registerTypeAdapters(final GsonBuilder
builder) and you'll see that we
have builder.registerTypeAdapter(LocalDate.class, new LocalDateAdapter());,
in under hood this "LocalDateAdapter" convert LocalDate to arrays dates...
So, all controllers, which used/using customGsonSerialization (had/has)
format array dates.

On Tue, Apr 15, 2025 at 11:58 AM Arnold Galovics <arn...@apache.org> wrote:

> Hi Viktor,
>
> I disagree. I don't think serializing LocalDates as arrays is a good idea
> (and it wasn't before either). The new Jackson serialization uses the
> ISO_DATE_FORMAT to serialize dates which is easily parseable by clients.
>
> So for all new APIs I'm recommending the ISO_DATE_FORMAT serialization and
> for old APIs which we wanna keep backward compatible, just use the Array
> serialization - although we need to move away from this for sure.
> To keep the backward compatibility and still use the Jackson
> serialization, I just created last week an opt-in way to fall back to the
> old serialization approach, you can check it here:
> https://github.com/apache/fineract/pull/4556/files
>
> Best,
> Arnold
>
> On Tue, Apr 15, 2025 at 7:13 AM Viktor Pavlenko
> <viktor.pavle...@onix-systems.com.invalid> wrote:
>
>> By default, Jackson should be configured to handle LocalDate as an array
>> of dates.
>> All controllers which use GSON work on "custom" not good serialization,
>> and this converts LocalDate to array dates. So, all APIs have been working
>> with array dates format. And when we migrate to Jacskon - we must follow
>> this rule!
>>
>> So, I have created an issue in Jira
>> https://issues.apache.org/jira/browse/FINERACT-2261 and PR ready to
>> review.
>>
>

Reply via email to