Is there a way to have a sort of `Unknown` sealed ...
# serialization
u
Is there a way to have a sort of
Unknown
sealed class child, that will be a fallback when all other classes don't match? (With annotations only? I know I can have a custom serializer a wire it up manually)
Copy code
@Serializable
sealed class Item {

   @SerialName("A")
   @Serializable
   data class ChildA(..) : Item()

   @Serializable
   data class Unknown : Item() <--------
}
m
You need to specify a default deserializer in the module.
Copy code
SerializesModule {
  polymorphic(Item::class) {
     defaultDeserializer { Item.Unknown.serializer() }
  }
}
☝🏼 1
u
okay so no annotation only way? shame, thanks