Skip to content

Commit b22cf10

Browse files
committed
Fix kotlin samples
1 parent 1f242a9 commit b22cf10

4 files changed

Lines changed: 39 additions & 30 deletions

File tree

samples/server/others/kotlin-server/polymorphism/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# org.openapitools.server - Kotlin Server library for Polymorphism example with allOf and discriminator
1+
# org.openapitools.server - Kotlin Server library for Basic polymorphism example without discriminator
22

33
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44

samples/server/others/kotlin-server/polymorphism/src/main/kotlin/org/openapitools/server/models/Cat.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Polymorphism example with allOf and discriminator
2+
* Basic polymorphism example without discriminator
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
55
* The version of the OpenAPI document: 1.0
@@ -11,24 +11,21 @@
1111
*/
1212
package org.openapitools.server.models
1313

14-
import org.openapitools.server.models.Pet
1514

1615
/**
17-
* A representation of a cat
16+
* A pet cat
1817
* @param huntingSkill The measured skill for hunting
18+
* @param petType
1919
*/
2020
data class Cat(
2121
/* The measured skill for hunting */
2222

2323
@field:com.fasterxml.jackson.annotation.JsonProperty("huntingSkill")
2424
val huntingSkill: Cat.HuntingSkill,
2525

26-
@field:com.fasterxml.jackson.annotation.JsonProperty("name")
27-
override val name: kotlin.String,
28-
2926
@field:com.fasterxml.jackson.annotation.JsonProperty("petType")
30-
override val petType: kotlin.String
31-
) : Pet(name = name, petType = petType)
27+
val petType: kotlin.Any? = null
28+
)
3229
{
3330
/**
3431
* The measured skill for hunting
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Polymorphism example with allOf and discriminator
2+
* Basic polymorphism example without discriminator
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
55
* The version of the OpenAPI document: 1.0
@@ -11,24 +11,19 @@
1111
*/
1212
package org.openapitools.server.models
1313

14-
import org.openapitools.server.models.Pet
1514

1615
/**
17-
* A representation of a dog
16+
* A pet dog
1817
* @param packSize the size of the pack the dog is from
18+
* @param petType
1919
*/
2020
data class Dog(
2121
/* the size of the pack the dog is from */
2222

2323
@field:com.fasterxml.jackson.annotation.JsonProperty("packSize")
2424
val packSize: kotlin.Int = 0,
2525

26-
@field:com.fasterxml.jackson.annotation.JsonProperty("name")
27-
override val name: kotlin.String,
28-
2926
@field:com.fasterxml.jackson.annotation.JsonProperty("petType")
30-
override val petType: kotlin.String
31-
) : Pet(name = name, petType = petType)
32-
{
33-
}
27+
val petType: kotlin.Any? = null
28+
)
3429

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Polymorphism example with allOf and discriminator
2+
* Basic polymorphism example without discriminator
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
55
* The version of the OpenAPI document: 1.0
@@ -11,25 +11,42 @@
1111
*/
1212
package org.openapitools.server.models
1313

14+
import org.openapitools.server.models.Cat
15+
import org.openapitools.server.models.Dog
1416

1517
/**
1618
*
1719
* @param name
1820
* @param petType
21+
* @param huntingSkill The measured skill for hunting
22+
* @param packSize the size of the pack the dog is from
1923
*/
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(
2625

2726
@field:com.fasterxml.jackson.annotation.JsonProperty("name")
28-
open val name: kotlin.String
29-
,
27+
val name: kotlin.String,
3028

3129
@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
3439
)
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+
}
3552

0 commit comments

Comments
 (0)