Jovan
10/28/2020, 12:42 PMval module = SerializersModule {
polymorphic(Project::class) {
subclass(OwnedProject::class)
}
}
So, I was looking into Open polymorphism and can’t get it working for me.
For some reason it only works when I have two levels, like in the example from above. How to init SerializersModule in case I have 3+ levels (e.g. OwnedProject is parent of OwnedChildeProject)?sandwwraith
10/28/2020, 12:46 PMpolymorphic
several times. You can use a loop for that: https://github.com/Kotlin/kotlinx.serialization/blob/c041c2c92b96c353958843be78084bfd3a4fc1de/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt#L66Jovan
10/28/2020, 1:14 PM