diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/GitHub873.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/GitHub873.kt new file mode 100644 index 000000000..3587dcde6 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/GitHub873.kt @@ -0,0 +1,45 @@ +package com.fasterxml.jackson.module.kotlin.test.github + +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import kotlin.test.Test + +class GitHub873 { + @Test + fun `should serialize value class`() { + + val person = Person( + mapOf( + "id" to "123", + "updated" to "2023-11-22 12:11:23", + "login" to "2024-01-15", + ), + ) + + val serialized = jacksonObjectMapper().writeValueAsString( + TimestampedPerson( + 123L, + Person(person.properties), + ) + ) + + val deserialized = jacksonObjectMapper().readValue(serialized) + + assert( + deserialized == TimestampedPerson( + 123L, + Person(person.properties), + ) + ) + } + + @JvmInline + value class Person( + val properties: Map, + ) + + data class TimestampedPerson( + val timestamp: Long, + val person: Person, + ) +}