|
1 | 1 | /** |
2 | | - * Polymorphism example with allOf and discriminator |
| 2 | + * Basic polymorphism example without discriminator |
3 | 3 | * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) |
4 | 4 | * |
5 | 5 | * The version of the OpenAPI document: 1.0 |
|
11 | 11 | */ |
12 | 12 | package org.openapitools.server.models |
13 | 13 |
|
| 14 | +import org.openapitools.server.models.Cat |
| 15 | +import org.openapitools.server.models.Dog |
14 | 16 |
|
15 | 17 | /** |
16 | 18 | * |
17 | 19 | * @param name |
18 | 20 | * @param petType |
| 21 | + * @param huntingSkill The measured skill for hunting |
| 22 | + * @param packSize the size of the pack the dog is from |
19 | 23 | */ |
20 | | -@com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, property = "petType", visible = true) |
21 | | -@com.fasterxml.jackson.annotation.JsonSubTypes( |
22 | | - com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Cat::class, name = "Cat"), |
23 | | - com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Dog::class, name = "Dog") |
24 | | -) |
25 | | -sealed class Pet( |
| 24 | +data class Pet( |
26 | 25 |
|
27 | 26 | @field:com.fasterxml.jackson.annotation.JsonProperty("name") |
28 | | - open val name: kotlin.String |
29 | | -, |
| 27 | + val name: kotlin.String, |
30 | 28 |
|
31 | 29 | @field:com.fasterxml.jackson.annotation.JsonProperty("petType") |
32 | | - open val petType: kotlin.String |
33 | | - |
| 30 | + val petType: kotlin.Any?, |
| 31 | + /* The measured skill for hunting */ |
| 32 | + |
| 33 | + @field:com.fasterxml.jackson.annotation.JsonProperty("huntingSkill") |
| 34 | + val huntingSkill: Pet.HuntingSkill, |
| 35 | + /* the size of the pack the dog is from */ |
| 36 | + |
| 37 | + @field:com.fasterxml.jackson.annotation.JsonProperty("packSize") |
| 38 | + val packSize: kotlin.Int = 0 |
34 | 39 | ) |
| 40 | +{ |
| 41 | + /** |
| 42 | + * The measured skill for hunting |
| 43 | + * Values: clueless,lazy,adventurous,aggressive |
| 44 | + */ |
| 45 | + enum class HuntingSkill(val value: kotlin.String){ |
| 46 | + clueless("clueless"), |
| 47 | + lazy("lazy"), |
| 48 | + adventurous("adventurous"), |
| 49 | + aggressive("aggressive"); |
| 50 | + } |
| 51 | +} |
35 | 52 |
|
0 commit comments