Hi all, I'm having trouble using a `JsonTransformi...
# serialization
g
Hi all, I'm having trouble using a
JsonTransformingSerializer
with a subclass, in that specifying the serializer in the mapper module doesn't seem to work. If I have:
Copy code
object JsonTransforming : JsonTransformingSerializer<MessageConfiguration>(
    MessageConfiguration.serializer()
) {...}
and set up a mapper as
Copy code
Json { 
    classDiscriminator = "_type"
    serializersModule = SerializersModule {
        polymorphic(MessageBase::class, MessageConfiguration::class, JsonTransforming)
    }
}
Then calling
decodeFromString
only works properly if I pass in the serialization strategy explicitly.
Copy code
decodeFromString<MessageBase>(JsonTransforming, input) // This works
decodeFromString<MessageBase>(input) // This doesn't run the transformer
My expectation is that specifying the
polymorphic
bit in the
serializersModule
would be sufficient for the deserializer to apply the transformer when it's deserializing a
MessageConfiguration
, but it seems not. What am I doing wrong?