snowe
03/19/2024, 9:21 PM@Serializable(with = TaxSerializer::class)
interface LineResponseTaxesInner {
and then my custom serializer
object TaxSerializer : JsonContentPolymorphicSerializer<LineResponseTaxesInner>(LineResponseTaxesInner::class) {
override fun selectDeserializer(element: JsonElement) = when {
"FullDetails" in element.jsonObject -> Tax.serializer()
else -> TaxSummary.serializer()
}
}
Weirdly this works completely fine locally, but fails when compiled as a graalvm native image and run in aws…Adam S
03/20/2024, 8:35 AM@Serializable
to the interface, but instead, registering it (and the subtypes) in the SerializersModule https://github.com/Kotlin/kotlinx.serialization/blob/v1.6.3/docs/polymorphism.md#registered-subclassesAdam S
03/20/2024, 8:37 AMsnowe
03/20/2024, 6:03 PMBlah.serializer()
rather than the extension functions. Hm..