yamlkt icon indicating copy to clipboard operation
yamlkt copied to clipboard

Wrong handling of null value in nested nullable String field

Open gwidion opened this issue 2 years ago • 0 comments

@Serializable
data class Foo(
    val bar: Bar,
    val topValue: String? = null,
)

@Serializable
data class Bar(
    val subValue: String? = null,
)

val foo = Yaml.decodeFromString<Foo>("""
  bar:
    subValue:
  topValue: string
""".trimIndent())
println(foo)

prints Foo(bar=Bar(subValue=topValue), topValue=null) instead of Foo(bar=Bar(subValue=null), topValue=string)

gwidion avatar Jul 29 '23 16:07 gwidion