Hi all, I'm facing an issue to upgrade from Kotlin...
# jackson-kotlin
y
Hi all, I'm facing an issue to upgrade from Kotlin
1.7.x
to version
1.8.x
or above because of serialization value classes inside of a data class. Let's consider the following example:
Copy code
@JvmInline
value class Value(val i: Int)

data class Data(val j: Value)

data class Wrapper(val value: Value, val data: Data)
When trying the following code:
Copy code
val objectMapper = jacksonObjectMapper()
    .setPropertyNamingStrategy(PropertyNamingStrategies.SnakeCaseStrategy())
    .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
    .registerModule(JavaTimeModule())

val json = """{"i":1,"j":771}"""

val deserialized = objectMapper.readValue<Wrapper>(json)
This code execution ends up with the following error:
(no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
. This can be resolved by adding an empty constructor to the classes, but it makes very little sense, and I'm afraid that it would be abused by other developers in the codebase... is there any alternative that I can use here to solve the issue?
Mmmm... found this discussion on GitHub - so I guess I should wait 🙈
👍 1