Join Slack
Powered by
Hello :wave: Is there a way to coerce default poly...
# serialization
d
Dariusz Kuc
03/01/2022, 12:32 AM
Hello 👋 Is there a way to coerce default polymorphic type programmatically? i.e. something like
https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#default-polymorphic-type-handler-for-deserialization
but by using only annotations Guess I can provide default value together with
Copy code
Json { coerceInputValues = true }
Dariusz Kuc
03/01/2022, 12:43 AM
actually that would only work for marker interfaces (no fields) :(
Dariusz Kuc
03/01/2022, 4:43 AM
*actually default value doesn't work for unknown polymorphic types even with coercing turned on and default values
Dariusz Kuc
03/01/2022, 4:51 AM
looks like this is the issue
https://github.com/Kotlin/kotlinx.serialization/issues/1575
6
Views
Open in Slack
Previous
Next