micronaut-serialization icon indicating copy to clipboard operation
micronaut-serialization copied to clipboard

Fix JsonNumber bson serialization

Open rorueda opened this issue 1 year ago • 1 comments
trafficstars

  • Always use the right number type when serializing, so formats that support the type info can deserialize to the correct type. Currently, if you serialize an int JsonNumber, when deserializing you get a long JsonNumber.
  • Fix fallback deserialization of custom Number implementations. The bson decoder advances when getBigDecimal is called - so, in the second call you either get an exception or one of the fields is swallowed.
  • Fix element index increment when serializing BigInteger. Increment is already done by encodeBigDecimal.

rorueda avatar Jul 23 '24 16:07 rorueda

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 23 '24 16:07 CLAassistant

Thanks for the PR. I have corrected the new method.

dstepanov avatar Oct 29 '24 08:10 dstepanov