snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

Difference in object serialization between REST and REST reactive #306

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 3 years ago

We are trying to serialize a MonetaryAmount object. However, the CurrencyUnit member of this object is serialized differently in REST and REST Reactive.

In REST, the attached serializer (see class io.i15s.quarkus.objectmapper.ObjectMapperConfiguration) is used and therefore the object is formatted correctly:

{
   "amount":0,
   "currency":"EUR"
}

But when we use REST Reactive, the serializer is not used and the object is formatted using POJO serializer:

{
   "amount":0,
   "currency":{
      "context":{
         "empty":false,
         "providerName":"java.util.Currency"
      },
      "defaultFractionDigits":2,
      "currencyCode":"EUR",
      "numericCode":978
   }
}

The bug happens in Quarkus 1.12.0.Final - 1.12.2.Final and also in Quarkus 1.13.0.CR1

We created a small project to reproduce: https://github.com/andlinger/quarkus-object-mapper


https://github.com/quarkusio/quarkus/issues/16081


$upstream:16081$