forked from loafle/openapi-generator-original
* [Kotlin][Spring] fix #19244 integer enum * fix embedded array enum
This commit is contained in:
parent
c93ec54a16
commit
37afe57f0f
13
bin/configs/kotlin-spring-boot-integer-enum.yaml
Normal file
13
bin/configs/kotlin-spring-boot-integer-enum.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
generatorName: kotlin-spring
|
||||||
|
outputDir: samples/server/petstore/kotlin-springboot-integer-enum
|
||||||
|
library: spring-boot
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/issue19244_integer_enum.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
|
||||||
|
additionalProperties:
|
||||||
|
interfaceOnly: "true"
|
||||||
|
skipDefaultInterface: "true"
|
||||||
|
useTags: "true"
|
||||||
|
useSpringBoot3: "true"
|
||||||
|
annotationLibrary: none
|
||||||
|
documentationProvider: none
|
||||||
|
enumPropertyNaming: UPPERCASE
|
@ -815,6 +815,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
|||||||
model.imports.add("JsonProperty");
|
model.imports.add("JsonProperty");
|
||||||
if (Boolean.TRUE.equals(model.hasEnums)) {
|
if (Boolean.TRUE.equals(model.hasEnums)) {
|
||||||
model.imports.add("JsonValue");
|
model.imports.add("JsonValue");
|
||||||
|
model.imports.add("JsonCreator");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Needed imports for Jackson's JsonCreator
|
//Needed imports for Jackson's JsonCreator
|
||||||
@ -840,10 +841,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
|||||||
.filter(cm -> Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null)
|
.filter(cm -> Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null)
|
||||||
.forEach(cm -> {
|
.forEach(cm -> {
|
||||||
cm.imports.add(importMapping.get("JsonValue"));
|
cm.imports.add(importMapping.get("JsonValue"));
|
||||||
|
cm.imports.add(importMapping.get("JsonCreator"));
|
||||||
cm.imports.add(importMapping.get("JsonProperty"));
|
cm.imports.add(importMapping.get("JsonProperty"));
|
||||||
Map<String, String> itemJsonValue = new HashMap<>();
|
Map<String, String> itemJsonValue = new HashMap<>();
|
||||||
itemJsonValue.put("import", importMapping.get("JsonValue"));
|
itemJsonValue.put("import", importMapping.get("JsonValue"));
|
||||||
imports.add(itemJsonValue);
|
imports.add(itemJsonValue);
|
||||||
|
Map<String, String> itemJsonCreator = new HashMap<>();
|
||||||
|
itemJsonCreator.put("import", importMapping.get("JsonCreator"));
|
||||||
|
imports.add(itemJsonCreator);
|
||||||
Map<String, String> itemJsonProperty = new HashMap<>();
|
Map<String, String> itemJsonProperty = new HashMap<>();
|
||||||
itemJsonProperty.put("import", importMapping.get("JsonProperty"));
|
itemJsonProperty.put("import", importMapping.get("JsonProperty"));
|
||||||
imports.add(itemJsonProperty);
|
imports.add(itemJsonProperty);
|
||||||
|
@ -31,9 +31,17 @@
|
|||||||
* {{{description}}}
|
* {{{description}}}
|
||||||
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
*/
|
*/
|
||||||
enum class {{{nameInPascalCase}}}(val value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}) {
|
enum class {{{nameInPascalCase}}}(@get:JsonValue val value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}) {
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
@JsonProperty({{{value}}}) {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
{{{name}}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}};
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}): {{{nameInPascalCase}}} {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{{/isEnum}}{{/vars}}{{/hasEnums}}
|
{{/isEnum}}{{/vars}}{{/hasEnums}}
|
||||||
{{#serializableModel}}
|
{{#serializableModel}}
|
||||||
|
@ -2,7 +2,15 @@
|
|||||||
* {{{description}}}
|
* {{{description}}}
|
||||||
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
*/
|
*/
|
||||||
enum class {{classname}}(val value: {{dataType}}) {
|
enum class {{classname}}(@get:JsonValue val value: {{dataType}}) {
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
@JsonProperty({{{value}}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
{{&name}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}};
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: {{dataType}}): {{classname}} {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
openapi: 3.0.3
|
||||||
|
info:
|
||||||
|
description: >-
|
||||||
|
Example created
|
||||||
|
version: 1.0.0
|
||||||
|
title: OpenAPI Stuff API created to reproduce issue
|
||||||
|
license:
|
||||||
|
name: Apache-2.0
|
||||||
|
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||||
|
paths:
|
||||||
|
/healthcheck:
|
||||||
|
get:
|
||||||
|
summary: Health check endpoint.
|
||||||
|
operationId: healthcheck
|
||||||
|
responses:
|
||||||
|
204:
|
||||||
|
description: Successful health check
|
||||||
|
default:
|
||||||
|
description: Unexpected error
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
ApiError:
|
||||||
|
required:
|
||||||
|
- errorCode
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
errorCode:
|
||||||
|
type: integer
|
||||||
|
enum:
|
||||||
|
- 0
|
||||||
|
- 100
|
||||||
|
x-enum-varnames:
|
||||||
|
- OK
|
||||||
|
- ERROR
|
||||||
|
reasonCode:
|
||||||
|
$ref: '#/components/schemas/ReasonCode'
|
||||||
|
ReasonCode:
|
||||||
|
type: integer
|
||||||
|
enum:
|
||||||
|
- 10
|
||||||
|
- 20
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -42,11 +43,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -47,11 +48,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -83,11 +84,19 @@ data class AnyOfUserOrPet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -83,11 +84,19 @@ data class AnyOfUserOrPetOrArrayString(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import javax.validation.constraints.DecimalMax
|
import javax.validation.constraints.DecimalMax
|
||||||
@ -48,11 +49,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -83,11 +84,19 @@ data class UserOrPet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -83,11 +84,19 @@ data class UserOrPetOrArrayString(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -42,11 +43,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -47,11 +48,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import jakarta.validation.constraints.DecimalMax
|
import jakarta.validation.constraints.DecimalMax
|
||||||
@ -48,11 +49,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import javax.validation.constraints.DecimalMax
|
import javax.validation.constraints.DecimalMax
|
||||||
@ -48,11 +49,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
@ -0,0 +1,9 @@
|
|||||||
|
README.md
|
||||||
|
build.gradle.kts
|
||||||
|
pom.xml
|
||||||
|
settings.gradle
|
||||||
|
src/main/kotlin/org/openapitools/api/ApiUtil.kt
|
||||||
|
src/main/kotlin/org/openapitools/api/DefaultApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/api/Exceptions.kt
|
||||||
|
src/main/kotlin/org/openapitools/model/ApiError.kt
|
||||||
|
src/main/kotlin/org/openapitools/model/ReasonCode.kt
|
@ -0,0 +1 @@
|
|||||||
|
7.8.0-SNAPSHOT
|
@ -0,0 +1,21 @@
|
|||||||
|
# openAPIStuffAPICreatedToReproduceIssue
|
||||||
|
|
||||||
|
This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator).
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in.
|
||||||
|
|
||||||
|
By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl).
|
||||||
|
|
||||||
|
To build the project using maven, run:
|
||||||
|
```bash
|
||||||
|
mvn package && java -jar target/openapi-spring-1.0.0.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
To build the project using gradle, run:
|
||||||
|
```bash
|
||||||
|
gradle build && java -jar build/libs/openapi-spring-1.0.0.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/)
|
@ -0,0 +1,46 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
group = "org.openapitools"
|
||||||
|
version = "1.0.0"
|
||||||
|
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://repo.spring.io/milestone") }
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile> {
|
||||||
|
kotlinOptions.jvmTarget = "17"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.bootJar {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
val kotlinVersion = "1.7.10"
|
||||||
|
id("org.jetbrains.kotlin.jvm") version kotlinVersion
|
||||||
|
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
|
||||||
|
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
|
||||||
|
id("org.springframework.boot") version "3.0.2"
|
||||||
|
id("io.spring.dependency-management") version "1.0.14.RELEASE"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||||
|
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||||
|
|
||||||
|
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
||||||
|
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
|
||||||
|
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
||||||
|
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
||||||
|
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||||
|
implementation("jakarta.validation:jakarta.validation-api")
|
||||||
|
implementation("jakarta.annotation:jakarta.annotation-api:2.1.0")
|
||||||
|
|
||||||
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
|
||||||
|
testImplementation("org.springframework.boot:spring-boot-starter-test") {
|
||||||
|
exclude(module = "junit")
|
||||||
|
}
|
||||||
|
}
|
132
samples/server/petstore/kotlin-springboot-integer-enum/pom.xml
Normal file
132
samples/server/petstore/kotlin-springboot-integer-enum/pom.xml
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>openapi-spring</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>openapi-spring</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<properties>
|
||||||
|
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
|
||||||
|
<jakarta-annotation.version>2.1.0</jakarta-annotation.version>
|
||||||
|
<kotlin-test-junit5.version>1.7.10</kotlin-test-junit5.version>
|
||||||
|
|
||||||
|
<kotlin.version>1.7.10</kotlin.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.1.3</version>
|
||||||
|
</parent>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>repository.spring.milestone</id>
|
||||||
|
<name>Spring Milestone Repository</name>
|
||||||
|
<url>https://repo.spring.io/milestone</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>spring-milestones</id>
|
||||||
|
<url>https://repo.spring.io/milestone</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||||
|
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>kotlin-maven-plugin</artifactId>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<compilerPlugins>
|
||||||
|
<plugin>spring</plugin>
|
||||||
|
</compilerPlugins>
|
||||||
|
<jvmTarget>17</jvmTarget>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>test-compile</id>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test-compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-maven-allopen</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-reflect</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- @Nullable annotation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>${findbugs-jsr305.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
|
<artifactId>jackson-module-kotlin</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Bean Validation API support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.annotation</groupId>
|
||||||
|
<artifactId>jakarta.annotation-api</artifactId>
|
||||||
|
<version>${jakarta-annotation.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-test-junit5</artifactId>
|
||||||
|
<version>${kotlin-test-junit5.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,15 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||||
|
maven { url = uri("https://repo.spring.io/milestone") }
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
resolutionStrategy {
|
||||||
|
eachPlugin {
|
||||||
|
if (requested.id.id == "org.springframework.boot") {
|
||||||
|
useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootProject.name = "openapi-spring"
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.api
|
||||||
|
|
||||||
|
import org.springframework.web.context.request.NativeWebRequest
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletResponse
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
object ApiUtil {
|
||||||
|
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
|
||||||
|
try {
|
||||||
|
val res = req.getNativeResponse(HttpServletResponse::class.java)
|
||||||
|
res?.characterEncoding = "UTF-8"
|
||||||
|
res?.addHeader("Content-Type", contentType)
|
||||||
|
res?.writer?.print(example)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
throw RuntimeException(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.8.0-SNAPSHOT).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
package org.openapitools.api
|
||||||
|
|
||||||
|
import org.openapitools.model.ApiError
|
||||||
|
import org.springframework.http.HttpStatus
|
||||||
|
import org.springframework.http.MediaType
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*
|
||||||
|
import org.springframework.validation.annotation.Validated
|
||||||
|
import org.springframework.web.context.request.NativeWebRequest
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.DecimalMax
|
||||||
|
import jakarta.validation.constraints.DecimalMin
|
||||||
|
import jakarta.validation.constraints.Email
|
||||||
|
import jakarta.validation.constraints.Max
|
||||||
|
import jakarta.validation.constraints.Min
|
||||||
|
import jakarta.validation.constraints.NotNull
|
||||||
|
import jakarta.validation.constraints.Pattern
|
||||||
|
import jakarta.validation.constraints.Size
|
||||||
|
import jakarta.validation.Valid
|
||||||
|
|
||||||
|
import kotlin.collections.List
|
||||||
|
import kotlin.collections.Map
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Validated
|
||||||
|
interface DefaultApi {
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(
|
||||||
|
method = [RequestMethod.GET],
|
||||||
|
value = ["/healthcheck"],
|
||||||
|
produces = ["application/json"]
|
||||||
|
)
|
||||||
|
fun healthcheck(): ResponseEntity<Unit>
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package org.openapitools.api
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler
|
||||||
|
import jakarta.servlet.http.HttpServletResponse
|
||||||
|
import jakarta.validation.ConstraintViolationException
|
||||||
|
|
||||||
|
// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception
|
||||||
|
sealed class ApiException(msg: String, val code: Int) : Exception(msg)
|
||||||
|
|
||||||
|
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
|
||||||
|
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
class DefaultExceptionHandler {
|
||||||
|
|
||||||
|
@ExceptionHandler(value = [ApiException::class])
|
||||||
|
fun onApiException(ex: ApiException, response: HttpServletResponse): Unit =
|
||||||
|
response.sendError(ex.code, ex.message)
|
||||||
|
|
||||||
|
@ExceptionHandler(value = [NotImplementedError::class])
|
||||||
|
fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit =
|
||||||
|
response.sendError(HttpStatus.NOT_IMPLEMENTED.value())
|
||||||
|
|
||||||
|
@ExceptionHandler(value = [ConstraintViolationException::class])
|
||||||
|
fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit =
|
||||||
|
response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message })
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package org.openapitools.model
|
||||||
|
|
||||||
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
|
import org.openapitools.model.ReasonCode
|
||||||
|
import jakarta.validation.constraints.DecimalMax
|
||||||
|
import jakarta.validation.constraints.DecimalMin
|
||||||
|
import jakarta.validation.constraints.Email
|
||||||
|
import jakarta.validation.constraints.Max
|
||||||
|
import jakarta.validation.constraints.Min
|
||||||
|
import jakarta.validation.constraints.NotNull
|
||||||
|
import jakarta.validation.constraints.Pattern
|
||||||
|
import jakarta.validation.constraints.Size
|
||||||
|
import jakarta.validation.Valid
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param errorCode
|
||||||
|
* @param reasonCode
|
||||||
|
*/
|
||||||
|
data class ApiError(
|
||||||
|
|
||||||
|
@get:JsonProperty("errorCode", required = true) val errorCode: ApiError.ErrorCode,
|
||||||
|
|
||||||
|
@field:Valid
|
||||||
|
@get:JsonProperty("reasonCode") val reasonCode: ReasonCode? = null
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Values: OK,ERROR
|
||||||
|
*/
|
||||||
|
enum class ErrorCode(@get:JsonValue val value: kotlin.Int) {
|
||||||
|
|
||||||
|
OK(0),
|
||||||
|
ERROR(100);
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.Int): ErrorCode {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
package org.openapitools.model
|
||||||
|
|
||||||
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import jakarta.validation.constraints.DecimalMax
|
||||||
|
import jakarta.validation.constraints.DecimalMin
|
||||||
|
import jakarta.validation.constraints.Email
|
||||||
|
import jakarta.validation.constraints.Max
|
||||||
|
import jakarta.validation.constraints.Min
|
||||||
|
import jakarta.validation.constraints.NotNull
|
||||||
|
import jakarta.validation.constraints.Pattern
|
||||||
|
import jakarta.validation.constraints.Size
|
||||||
|
import jakarta.validation.Valid
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Values: _10,_20
|
||||||
|
*/
|
||||||
|
enum class ReasonCode(@get:JsonValue val value: kotlin.Int) {
|
||||||
|
|
||||||
|
_10(10),
|
||||||
|
_20(20);
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.Int): ReasonCode {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -49,11 +50,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -2,6 +2,7 @@ package org.openapitools.model
|
|||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import javax.validation.constraints.DecimalMax
|
import javax.validation.constraints.DecimalMax
|
||||||
import javax.validation.constraints.DecimalMin
|
import javax.validation.constraints.DecimalMin
|
||||||
@ -18,10 +19,18 @@ import io.swagger.v3.oas.annotations.media.Schema
|
|||||||
* additional field as Enum
|
* additional field as Enum
|
||||||
* Values: ALLOWED,IN_PROGRESS,REJECTED
|
* Values: ALLOWED,IN_PROGRESS,REJECTED
|
||||||
*/
|
*/
|
||||||
enum class MultipartMixedStatus(val value: kotlin.String) {
|
enum class MultipartMixedStatus(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("ALLOWED") ALLOWED("ALLOWED"),
|
ALLOWED("ALLOWED"),
|
||||||
@JsonProperty("IN_PROGRESS") IN_PROGRESS("IN_PROGRESS"),
|
IN_PROGRESS("IN_PROGRESS"),
|
||||||
@JsonProperty("REJECTED") REJECTED("REJECTED")
|
REJECTED("REJECTED");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): MultipartMixedStatus {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import javax.validation.constraints.DecimalMax
|
import javax.validation.constraints.DecimalMax
|
||||||
@ -48,11 +49,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -52,11 +53,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import jakarta.validation.constraints.DecimalMax
|
import jakarta.validation.constraints.DecimalMax
|
||||||
@ -48,11 +49,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -52,11 +53,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import jakarta.validation.constraints.DecimalMax
|
import jakarta.validation.constraints.DecimalMax
|
||||||
@ -48,11 +49,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -52,11 +53,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -49,11 +50,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -49,11 +50,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -49,11 +50,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -53,11 +54,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@ -42,11 +43,19 @@ data class Order(
|
|||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
placed("placed"),
|
||||||
@JsonProperty("approved") approved("approved"),
|
approved("approved"),
|
||||||
@JsonProperty("delivered") delivered("delivered")
|
delivered("delivered");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.model
|
package org.openapitools.model
|
||||||
|
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import org.openapitools.model.Category
|
import org.openapitools.model.Category
|
||||||
@ -46,11 +47,19 @@ data class Pet(
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: kotlin.String) {
|
enum class Status(@get:JsonValue val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
available("available"),
|
||||||
@JsonProperty("pending") pending("pending"),
|
pending("pending"),
|
||||||
@JsonProperty("sold") sold("sold")
|
sold("sold");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@JsonCreator
|
||||||
|
fun forValue(value: kotlin.String): Status {
|
||||||
|
return values().first{it -> it.value == value}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user