carp.core-kotlin
carp.core-kotlin copied to clipboard
Support other formats than JSON serialization
This has no priority at all, but, currently the core library presumes the infrastructure layer will rely on JSON serialization to pass data in between submodules (snapshot classes, such as StudyProtocolSnapshot). That is not an unreasonable constraint, given the benefit of not having to worry about serialization at all when using the core libraries which compile to multiple platforms.
However, kotlinx.serialization by itself does not presume any one particular serialization format. The only reason we are currently constrained to using JSON is because of UnknownPolymorphicSerializer, which relies on JSON serialization to work. This serializer is used to be able to deserialize types which are unknown at runtime, thus enabling client-side extensions to be dealt with completely transparently on a server-side that does not have client extensions available at runtime.
Could this implementation become agnostic of the serialization format used? If so, this could make an interesting addition to the kotlinx.serialization library.
Seems like relevant changes might be coming up in a new kotlinx.serialization release, but I haven't look at it in detail yet: https://github.com/Kotlin/kotlinx.serialization/issues/608