mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-04-24 02:39:10 +00:00
Update the sample to reflect changes
This commit is contained in:
@@ -25,9 +25,15 @@ import com.squareup.moshi.Json
|
||||
*/
|
||||
|
||||
|
||||
interface Animal {
|
||||
sealed class Animal {
|
||||
|
||||
@Json(name = "id")
|
||||
val id: java.util.UUID
|
||||
}
|
||||
|
||||
internal object AnimalSerializer : JsonContentPolymorphicSerializer<Animal>(Animal::class) {
|
||||
override fun selectDeserializer(element: JsonElement) = when {
|
||||
"BIRD" in element.jsonObject["type"].toString() -> Bird.serializer()
|
||||
else -> Animal.serializer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,5 +35,5 @@ data class Bird (
|
||||
@Json(name = "featherType")
|
||||
val featherType: kotlin.String
|
||||
|
||||
) : Animal
|
||||
) : Animal()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user