Open marvk opened 1 month ago
If possible, it'd be great to have Java-only reproduction -- if so, could transfer to jackson-dataformats-text
where this belong (but can't if there's Kotlin dependency).
@cowtowncoder Well, I can only reproduce it with Kotlin Value Classes, so I'm not sure how I would reproduce it in Java 😅 As far as I know, Java doesn't have a similar concept (yet?).
I was just hoping to confirm whether this is due to Kotlin Value Class specific details (in which case it might not be CSV-specific, fwtw), or not (in which case it is CSV specific).
In former case issue could remain here (if not CSV specific); in latter case moving to jackson-dataformats-text
.
But if both CSV and Kotlin aspects matter, probably needs to move to jackson-integration-tests
repo.
@marvk Could you please check #651?
Search before asking
Describe the bug
When trying to deserialize a CSV into a target class that contains a field that is a
value class
and theObjectMapper
has aCsvSchema
that has column reordering enabled, Jackson will produce the following exception, seemingly ignoring the@JsonProperty
annotations:This issue does not exist for data classes or if column reordering is disabled.
data class
value class
false
true
Related to #768.
To Reproduce
Please see the cloneable, runnable MCVE here.
The MCVE tests demonstrate that data classes work whether column reordering is enabled or not, and value classes work with column reordering disabled.
Main.kt
Test.kt
Expected behavior
Jackson deserializes the CSV without issues just like with data class fields or with column reordering disabled.
Versions
Kotlin: 1.9.23 Jackson-module-kotlin: 2.17.1 Jackson-databind: 2.17.1
Additional context
No response