You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library appears to be adding a redundant value: to members of a polymorphic collection.
This code:
@Serializable
data class ConfigFile(val items: List<Item>)
@Serializable
sealed class Item
@Serializable
@SerialName("A")
class ItemA(val property: String): Item()
println(Yaml.encodeToString(ConfigFile(listOf(ItemA("foo")))))
Yamlkt's polymorphism was not being tested, as stated in README that yamlkt does not support polymorohism. The current behavior may be some kind of fallback strategy implemented by kotlunx.serialization for custom formats that does not support polymorphism well.
Note that ProtoBuf also uses this format ('type' with proto number 1, 'value' with proto number 2).
The library appears to be adding a redundant
value:
to members of a polymorphic collection.This code:
Produces the following result:
This does not appear to be inline with
kotlinx.serialization
documentation: https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#sealed-classesIf using
Json
the result is as expected:The text was updated successfully, but these errors were encountered: