Skip to content

Commit 3da9b01

Browse files
committed
remove "status" inner enum from Pet as it fails to properly import as Pet.Status in implementations. This is a separate bug - not caused by x-kotlin-implements.
1 parent 3086ce8 commit 3da9b01

5 files changed

Lines changed: 2 additions & 35 deletions

File tree

modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,6 @@ components:
531531
type: array
532532
items:
533533
$ref: '#/components/schemas/Tag'
534-
status:
535-
type: string
536-
enum:
537-
- available
538-
- pending
539-
- sold
540534
color:
541535
$ref: '#/components/schemas/Color'
542536
petType:
@@ -587,6 +581,7 @@ components:
587581
name:
588582
type: string
589583
Color:
584+
x-kotlin-implements: [ com.some.pack.WithDefaultMethods ]
590585
type: string
591586
enum:
592587
- black

samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ data class Cat(
4545
@field:Valid
4646
@get:JsonProperty("tags") override val tags: kotlin.collections.List<Tag>? = null,
4747

48-
@get:JsonProperty("status") override val status: Cat.Status? = null,
49-
5048
@field:Valid
5149
@get:JsonProperty("color") override val color: Color? = null
5250
) : Pet, Serializable {

samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import javax.validation.Valid
2020
*
2121
* Values: black,white,brown,yellow,violet
2222
*/
23-
enum class Color(@get:JsonValue val value: kotlin.String) {
23+
enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDefaultMethods {
2424

2525
black("black"),
2626
white("white"),

samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ data class Dog(
4848
@field:Valid
4949
@get:JsonProperty("tags") override val tags: kotlin.collections.List<Tag>? = null,
5050

51-
@get:JsonProperty("status") override val status: Dog.Status? = null,
52-
5351
@field:Valid
5452
@get:JsonProperty("color") override val color: Color? = null
5553
) : Pet, Serializable, com.some.pack.Fetchable {

samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import javax.validation.Valid
3030
* @param id
3131
* @param category
3232
* @param tags
33-
* @param status
3433
* @param color
3534
*/
3635
@JsonIgnoreProperties(
@@ -63,32 +62,9 @@ interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, c
6362
val tags: kotlin.collections.List<Tag>?
6463

6564

66-
val status: Pet.Status?
67-
68-
6965
val color: Color?
7066

7167

72-
/**
73-
*
74-
* Values: available,pending,sold
75-
*/
76-
enum class Status(@get:JsonValue val value: kotlin.String) {
77-
78-
available("available"),
79-
pending("pending"),
80-
sold("sold");
81-
82-
companion object {
83-
@JvmStatic
84-
@JsonCreator
85-
fun forValue(value: kotlin.String): Status {
86-
return values().firstOrNull{it -> it.value == value}
87-
?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'")
88-
}
89-
}
90-
}
91-
9268
companion object {
9369
private const val serialVersionUID: kotlin.Long = 1
9470
}

0 commit comments

Comments
 (0)