Closed Whathecode closed 3 years ago
If this would work, it is likely we can support other formats than JSON as well: https://github.com/cph-cachet/carp.core-kotlin/issues/33 The main limitation why we cannot do this right now is because UnknownPolymorphicSerializer
relies on JSON string manipulations.
In order to handle unknown types we use custom
UnknownPolymorphicSerializer
in this library.It seems similar functionality is now supported out-of-the-box in
kotlinx.serialization
: https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#default-polymorphic-type-handler-for-deserializationWe should verify whether or not this provides all the functionality we currently implement ourselves, and replace our implementation with
kotlinx.serialization
in case it does.