FasterXML / jackson-jr

Stand-alone data-binding module designed as a light-weight (and -featured) alternative to `jackson-databind`: will only deal with "Maps, Lists, Strings, wrappers and Java Beans" (jr-objects), or simple read-only trees (jr-stree)
Apache License 2.0
239 stars 31 forks source link

Improve support for Java Record deserialization (field order) #157

Closed darxriggs closed 4 months ago

darxriggs commented 4 months ago

Basic support was added in #148. Its implementation assumes the same order of fields in the Java record and JSON.

This issue is about improving the deserialization to support any order of fields in the JSON. Currently deserialization fails with Failed to create an instance of SomeClass due to (java.lang.IllegalArgumentException): argument type mismatch in case the field order doesn't match (see this comment on the initial implementation).

cowtowncoder commented 4 months ago

Agreed: not sure how I missed this in review -- order can not and must not be assumed; matching strictly by name. We need tests for different order at minimum.

cc @TomaszGaweda

cowtowncoder commented 4 months ago

Initial Record deserialization support reverted due to issues, closing.