kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Kotlinx serialization ignores unknown enum

Open huthe98 opened this issue 1 year ago • 1 comments

Kotlinx serialization ignores unknown enums, val services: kotlin.collections.List<@Contextual ServiceGeneratedDto>?

Failure(io.ktor.serialization.JsonConvertException: .ServiceGeneratedDto does not contain element with name 'Cars' at path $[1].services[0])

huthe98 avatar Jan 25 '24 16:01 huthe98

Take a look here: https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/json.md#coercing-input-values

sandwwraith avatar Jan 25 '24 17:01 sandwwraith

"unknown values for enums" -- what does it mean? literally enum field called "unknown" or something else?

valeriyo avatar Aug 13 '24 00:08 valeriyo

@valeriyo Values that are not declared in the enum class in Kotlin. See example in the mentioned section.

sandwwraith avatar Aug 15 '24 12:08 sandwwraith