diff --git a/bin/configs/kotlin-spring-boot-integer-enum.yaml b/bin/configs/kotlin-spring-boot-integer-enum.yaml index 0b23e72b5bf6..bf7c62c6a0c4 100644 --- a/bin/configs/kotlin-spring-boot-integer-enum.yaml +++ b/bin/configs/kotlin-spring-boot-integer-enum.yaml @@ -11,4 +11,5 @@ additionalProperties: annotationLibrary: none documentationProvider: none enumPropertyNaming: UPPERCASE + enumUnknownDefaultCase: "true" useEnumValueInterface: "true" diff --git a/bin/configs/kotlin-spring-boot-oneof-enum-discriminator.yaml b/bin/configs/kotlin-spring-boot-oneof-enum-discriminator.yaml index 235978710b26..c0e2aabcfa26 100644 --- a/bin/configs/kotlin-spring-boot-oneof-enum-discriminator.yaml +++ b/bin/configs/kotlin-spring-boot-oneof-enum-discriminator.yaml @@ -9,3 +9,4 @@ additionalProperties: useSwaggerUI: "false" interfaceOnly: "true" useSpringBoot3: "true" + enumUnknownDefaultCase: "true" diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index a636658d17f4..1e25ae5c57f5 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |delegatePattern|Whether to generate the server files using the delegate pattern| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', 'original', and 'bestEffortBacktick' (like 'original' but tries to wrap values in backticks before falling back to sanitizing, e.g. `name,asc` stays `name,asc` rather than becoming nameCommaAsc; useful for sort/order enums)| |original| +|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.| |false| |exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true| |generatePageableConstraintValidation|Generate a @ValidPageable annotation and PageableConstraintValidator class, and apply @ValidPageable to the injected Pageable parameter of operations whose 'page' or 'size' parameter specifies a maximum constraint. The annotation enforces those constraints on the Pageable object that replaces the individual page/size query parameters. Requires useBeanValidation=true and library=spring-boot.| |false| |generateSortValidation|Generate a @ValidSort annotation and SortValidator class, and apply @ValidSort to the injected Pageable parameter of operations whose 'sort' parameter has enum values. The annotation validates that sort values in the Pageable object match the allowed enum values from the spec. Requires useBeanValidation=true and library=spring-boot.| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index 619d44868dc4..45ba7dcd10ca 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -315,6 +315,8 @@ public KotlinSpringServerCodegen() { addSwitch(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", companionObject); addSwitch(SUSPEND_FUNCTIONS, "Whether to generate suspend functions for API operations. Useful for Spring MVC with Kotlin coroutines without requiring the full reactive stack.", suspendFunctions); cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES, CodegenConstants.USE_DEDUCTION_FOR_ONE_OF_INTERFACES_DESC, useDeductionForOneOfInterfaces)); + cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE_DESC).defaultValue("false")); + addSwitch(CodegenConstants.USE_ENUM_VALUE_INTERFACE, CodegenConstants.USE_ENUM_VALUE_INTERFACE_DESC, useEnumValueInterface); addSwitch(CodegenConstants.OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library (jackson-databind-nullable) for strict null handling. " @@ -673,6 +675,11 @@ public void processOpts() { } writePropertyBack(SKIP_DEFAULT_INTERFACE, skipDefaultInterface); + + if (additionalProperties.containsKey(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE)) { + setEnumUnknownDefaultCase(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE).toString())); + } + if (additionalProperties.containsKey(REACTIVE)) { if (SPRING_CLOUD_LIBRARY.equals(library)) { throw new IllegalArgumentException("Currently, reactive option doesn't supported by Spring Cloud"); diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache index 3eeb19e70bcd..e7ddc3f03ab6 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache @@ -49,15 +49,26 @@ * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ enum class {{{nameInPascalCase}}}(@get:JsonValue {{#useEnumValueInterface}}{{^isContainer}}override {{/isContainer}}{{/useEnumValueInterface}}val value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}) {{#vendorExtensions.x-kotlin-implements}}{{#-first}}: {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}} {{/vendorExtensions.x-kotlin-implements}}{ -{{#allowableValues}}{{#enumVars}} - {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}; - + {{#allowableValues}}{{#enumVars}} + {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + companion object { @JvmStatic @JsonCreator fun forValue(value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}): {{{nameInPascalCase}}} { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum '{{nameInPascalCase}}'") + return values().firstOrNull{ it.value == value } + {{#enumUnknownDefaultCase}} + {{#allowableValues}} + {{#enumVars}} + {{#-last}} + ?: {{{name}}} + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + {{/enumUnknownDefaultCase}} + {{^enumUnknownDefaultCase}} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum '{{nameInPascalCase}}'") + {{/enumUnknownDefaultCase}} } } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache index d22051e2367a..fb2135c8ea95 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache @@ -1,17 +1,33 @@ /** -* {{{description}}} -* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} -*/ -enum class {{classname}}(@get:JsonValue {{#useEnumValueInterface}}override {{/useEnumValueInterface}}val value: {{dataType}}) {{#vendorExtensions.x-kotlin-implements}}{{#-first}}: {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}} {{/vendorExtensions.x-kotlin-implements}}{ -{{#allowableValues}}{{#enumVars}} - {{&name}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}; + * {{{description}}} + * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} + */ +enum class {{classname}}(@get:JsonValue {{#useEnumValueInterface}}override {{/useEnumValueInterface}}val value: {{dataType}}){{#vendorExtensions.x-kotlin-implements}}{{#-first}} : {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-kotlin-implements}} { +{{#allowableValues}} +{{#enumVars}} + {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} +{{/enumVars}} +{{/allowableValues}} companion object { @JvmStatic @JsonCreator fun forValue(value: {{dataType}}): {{classname}} { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum '{{classname}}'") + return values().firstOrNull{ it.value == value } + {{#enumUnknownDefaultCase}} + {{#allowableValues}} + {{#enumVars}} + {{#-last}} + ?: {{&name}} + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + {{/enumUnknownDefaultCase}} + {{^enumUnknownDefaultCase}} + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum '{{classname}}'" + ) + {{/enumUnknownDefaultCase}} } } -} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index 7fbc5ceea289..1e28026dab67 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -4,6 +4,7 @@ import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.parser.core.models.ParseOptions; import org.apache.commons.io.FileUtils; @@ -11,6 +12,8 @@ import org.jetbrains.annotations.NotNull; import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.DefaultGenerator; import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.config.CodegenConfigurator; @@ -23,6 +26,8 @@ import org.openapitools.codegen.languages.features.DocumentationProviderFeatures.AnnotationLibrary; import org.openapitools.codegen.languages.features.DocumentationProviderFeatures.DocumentationProvider; import org.openapitools.codegen.languages.features.SwaggerUIFeatures; +import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.ModelMap; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -6778,6 +6783,99 @@ public void schemaMappingWithNullableAllOfRendersNullableKotlinProperty() throws assertThat(content).contains("com.example.ExternalModel?"); } + @Test(description = "test enumUnknownDefaultCase option") + public void testEnumUnknownDefaultCaseOption() { + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + + // Test default value is false + codegen.processOpts(); + Assert.assertEquals(codegen.getEnumUnknownDefaultCase(), Boolean.FALSE); + + // Test setting via additionalProperties + codegen.additionalProperties().put(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, "true"); + codegen.processOpts(); + Assert.assertEquals(codegen.getEnumUnknownDefaultCase(), Boolean.TRUE); + } + + @Test(description = "test enum generation with enumUnknownDefaultCase enabled") + public void testEnumGenerationWithUnknownDefaultCase() throws IOException { + Map files = generateFromContract( + "src/test/resources/3_1/enum_unknown_default_case.yaml", + Map.of( + CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, true + ), + new HashMap<>(), + configurator -> {} + ); + + File colorFile = files.get("ColorEnum.kt"); + assertThat(colorFile).isNotNull(); + + String content = Files.readString(colorFile.toPath()); + + assertThat(content).contains("unknown_default_open_api(\"unknown_default_open_api\")"); + assertThat(content).contains("?: unknown_default_open_api"); + } + + @Test(description = "test enum generation with enumUnknownDefaultCase disabled") + public void testEnumGenerationWithoutUnknownDefaultCase() throws IOException { + Map files = generateFromContract( + "src/test/resources/3_1/enum_unknown_default_case.yaml", + Map.of( + CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, false + ), + new HashMap<>(), + configurator -> {} + ); + + File colorFile = files.get("ColorEnum.kt"); + assertThat(colorFile).isNotNull(); + + String content = Files.readString(colorFile.toPath()); + + assertThat(content).doesNotContain("unknown_default_open_api(\"unknown_default_open_api\")"); + assertThat(content).doesNotContain("?: unknown_default_open_api"); + } + + @Test(description = "test data class generation containing inline enum with enumUnknownDefaultCase enabled") + public void testDataClassGenerationWithUnknownDefaultCase() throws IOException { + Map files = generateFromContract( + "src/test/resources/3_1/dataclass_unknown_default_case.yaml", + Map.of( + CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, true + ), + new HashMap<>(), + configurator -> {} + ); + + File colorResponseFile = files.get("ColorResponse.kt"); + assertThat(colorResponseFile).isNotNull(); + + String content = Files.readString(colorResponseFile.toPath()); + + assertThat(content).contains("unknown_default_open_api(\"unknown_default_open_api\")"); + assertThat(content).contains("?: unknown_default_open_api"); + } + + @Test(description = "test data class generation containing inline enum with enumUnknownDefaultCase disabled") + public void testDataClassGenerationWithoutUnknownDefaultCase() throws IOException { + Map files = generateFromContract( + "src/test/resources/3_1/dataclass_unknown_default_case.yaml", + Map.of( + CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, false + ), + new HashMap<>(), + configurator -> {} + ); + + File colorResponseFile = files.get("ColorResponse.kt"); + assertThat(colorResponseFile).isNotNull(); + + String content = Files.readString(colorResponseFile.toPath()); + + assertThat(content).doesNotContain("unknown_default_open_api(\"unknown_default_open_api\")"); + assertThat(content).doesNotContain("?: unknown_default_open_api"); + @Test(description = "nameMappings: @param:JsonProperty must use the original JSON field name for deserialization") public void paramJsonPropertyAnnotationWithNameMappings() throws IOException { // When a property is renamed via nameMappings, @param:JsonProperty must carry the diff --git a/modules/openapi-generator/src/test/resources/3_1/dataclass_unknown_default_case.yaml b/modules/openapi-generator/src/test/resources/3_1/dataclass_unknown_default_case.yaml new file mode 100644 index 000000000000..ce5711a2e043 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/dataclass_unknown_default_case.yaml @@ -0,0 +1,39 @@ +openapi: 3.0.0 +info: + title: Dataclass Nested Enum Test API + description: API for testing inline/nested enum generation in data classes with enumUnknownDefaultCase + version: 1.0.0 +paths: + /colors: + get: + summary: Get color + operationId: getColor + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/ColorResponse' +components: + schemas: + ColorResponse: + type: object + required: + - color + properties: + color: + type: string + description: Available colors + enum: + - RED + - GREEN + - BLUE + - YELLOW + priority: + type: integer + description: Priority levels + enum: + - 1 + - 2 + - 3 diff --git a/modules/openapi-generator/src/test/resources/3_1/enum_unknown_default_case.yaml b/modules/openapi-generator/src/test/resources/3_1/enum_unknown_default_case.yaml new file mode 100644 index 000000000000..05f23cbaef7b --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/enum_unknown_default_case.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + title: Enum Test API + description: API for testing enum generation with enumUnknownDefaultCase + version: 1.0.0 +paths: + /colors: + get: + summary: Get color + operationId: getColor + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/ColorResponse' +components: + schemas: + ColorResponse: + type: object + required: + - color + - status + properties: + color: + $ref: '#/components/schemas/ColorEnum' + status: + $ref: '#/components/schemas/StatusEnum' + priority: + $ref: '#/components/schemas/PriorityEnum' + ColorEnum: + type: string + description: Available colors + enum: + - RED + - GREEN + - BLUE + - YELLOW + StatusEnum: + type: string + description: Status values + enum: + - PENDING + - APPROVED + - REJECTED + - IN_PROGRESS + PriorityEnum: + type: integer + description: Priority levels + enum: + - 1 + - 2 + - 3 + - 4 + - 5 \ No newline at end of file diff --git a/samples/server/others/kotlin-springboot/oneOf-discriminator-const/src/main/kotlin/org/openapitools/model/Cat.kt b/samples/server/others/kotlin-springboot/oneOf-discriminator-const/src/main/kotlin/org/openapitools/model/Cat.kt index d5af2e05d658..92d3bdd7c843 100644 --- a/samples/server/others/kotlin-springboot/oneOf-discriminator-const/src/main/kotlin/org/openapitools/model/Cat.kt +++ b/samples/server/others/kotlin-springboot/oneOf-discriminator-const/src/main/kotlin/org/openapitools/model/Cat.kt @@ -37,18 +37,18 @@ data class Cat( * Values: clueless,lazy,adventurous,aggressive */ enum class HuntingSkill(@get:JsonValue val value: kotlin.String) { - + clueless("clueless"), lazy("lazy"), adventurous("adventurous"), aggressive("aggressive"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): HuntingSkill { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'HuntingSkill'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'HuntingSkill'") } } } diff --git a/samples/server/others/kotlin-springboot/oneOf-enum-discriminator/src/main/kotlin/org/openapitools/model/VehicleType.kt b/samples/server/others/kotlin-springboot/oneOf-enum-discriminator/src/main/kotlin/org/openapitools/model/VehicleType.kt index 400f44e12a77..1a6c28c494ae 100644 --- a/samples/server/others/kotlin-springboot/oneOf-enum-discriminator/src/main/kotlin/org/openapitools/model/VehicleType.kt +++ b/samples/server/others/kotlin-springboot/oneOf-enum-discriminator/src/main/kotlin/org/openapitools/model/VehicleType.kt @@ -15,21 +15,20 @@ import jakarta.validation.constraints.Size import jakarta.validation.Valid /** -* -* Values: CAR,TRUCK -*/ + * + * Values: CAR,TRUCK,unknown_default_open_api + */ enum class VehicleType(@get:JsonValue val value: kotlin.String) { - CAR("CAR"), - TRUCK("TRUCK"); + TRUCK("TRUCK"), + unknown_default_open_api("unknown_default_open_api"); companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): VehicleType { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'VehicleType'") + return values().firstOrNull{ it.value == value } + ?: unknown_default_open_api } } } - diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt index c185ea107046..3ef0caae6927 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt index 978290446045..29c4c89c33e9 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt @@ -65,17 +65,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Order.kt index 858d62c81958..91bd6886182b 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Pet.kt index 1f4269d35cca..6ede75a99a7f 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-bean-validation/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Order.kt index 858d62c81958..91bd6886182b 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Pet.kt index 1f4269d35cca..6ede75a99a7f 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Order.kt index 858d62c81958..91bd6886182b 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt index 1f4269d35cca..6ede75a99a7f 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Order.kt index 858d62c81958..91bd6886182b 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt index 1f4269d35cca..6ede75a99a7f 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface-wrapped/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Order.kt index 858d62c81958..91bd6886182b 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Pet.kt index 1f4269d35cca..6ede75a99a7f 100644 --- a/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-declarative-interface/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt index 5344311246f7..f3179b87ccdd 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt @@ -121,17 +121,17 @@ data class AnyOfUserOrPet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt index 60d2f3bc9c93..5429e1756e9b 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt @@ -121,17 +121,17 @@ data class AnyOfUserOrPetOrArrayString( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt index fc6ac8284963..1ba07c6a7b26 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt index 1a5fa08a8a18..813d35d2fc06 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Order.kt index 79363b092edf..8dd4a43679c8 100644 --- a/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Order.kt @@ -66,17 +66,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Pet.kt index 0de23f8edb3c..f2c71d8b69b5 100644 --- a/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-sealed-interfaces/src/main/kotlin/org/openapitools/model/Pet.kt @@ -68,17 +68,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt index 486848e14599..d8348e82bf50 100644 --- a/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt index 56c523367969..c5d573146455 100644 --- a/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-3-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt @@ -65,17 +65,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt index 486848e14599..d8348e82bf50 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt index 56c523367969..c5d573146455 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt @@ -65,17 +65,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Order.kt index 486848e14599..d8348e82bf50 100644 --- a/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Pet.kt index 56c523367969..c5d573146455 100644 --- a/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-4/src/main/kotlin/org/openapitools/model/Pet.kt @@ -65,17 +65,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt index 486848e14599..d8348e82bf50 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt index c076750eb99a..ff61d8bef95b 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt @@ -65,17 +65,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt index 0744ff2d4e47..4d5a1b590537 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt index e10512ead290..dc510cf2be33 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt index fc6ac8284963..1ba07c6a7b26 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt index 1466d9480ad8..627b004b5fae 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Color.kt b/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Color.kt index 13da2b5afecf..30e0d5fc5230 100644 --- a/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Color.kt +++ b/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Color.kt @@ -16,11 +16,10 @@ import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** -* -* Values: black,white,brown,yellow,violet -*/ -enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDefaultMethods , java.io.Serializable { - + * + * Values: black,white,brown,yellow,violet + */ +enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDefaultMethods, java.io.Serializable { black("black"), white("white"), brown("brown"), @@ -31,9 +30,10 @@ enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDe @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Color { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Color'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum 'Color'" + ) } } } - diff --git a/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Dog.kt index 2a51c2aae5da..582413985b43 100644 --- a/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Dog.kt +++ b/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Dog.kt @@ -94,18 +94,18 @@ data class Dog( * Values: Dingo,Husky,Retriever,Shepherd */ enum class Breed(@get:JsonValue val value: kotlin.String) { - + Dingo("Dingo"), Husky("Husky"), Retriever("Retriever"), Shepherd("Shepherd"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Breed { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Breed'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Breed'") } } } diff --git a/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Order.kt index f4f0ff415e06..59bdb195718a 100644 --- a/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt index c7effc69943c..339950ef915b 100644 --- a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt +++ b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt @@ -38,19 +38,20 @@ data class ApiError( /** * - * Values: OK,ERROR + * Values: OK,ERROR,UNKNOWN_DEFAULT_OPEN_API */ enum class ErrorCode(@get:JsonValue override val value: kotlin.Int) : ValuedEnum { - + OK(0), - ERROR(100); - + ERROR(100), + UNKNOWN_DEFAULT_OPEN_API(11184809); + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.Int): ErrorCode { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'ErrorCode'") + return values().firstOrNull{ it.value == value } + ?: UNKNOWN_DEFAULT_OPEN_API } } } diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ReasonCode.kt b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ReasonCode.kt index 96efb7984c28..3a3682f35c8a 100644 --- a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ReasonCode.kt +++ b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ReasonCode.kt @@ -16,21 +16,20 @@ import jakarta.validation.constraints.Size import jakarta.validation.Valid /** -* -* Values: _10,_20 -*/ + * + * Values: _10,_20,UNKNOWN_DEFAULT_OPEN_API + */ enum class ReasonCode(@get:JsonValue override val value: kotlin.Int) : ValuedEnum { - _10(10), - _20(20); + _20(20), + UNKNOWN_DEFAULT_OPEN_API(11184809); companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.Int): ReasonCode { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'ReasonCode'") + return values().firstOrNull{ it.value == value } + ?: UNKNOWN_DEFAULT_OPEN_API } } } - diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt index bf17370744c9..d34386a95476 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt index 5acd72ff27ae..e8d3636c479c 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt @@ -71,17 +71,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedStatus.kt b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedStatus.kt index a84813d0ee44..25c30dd3185c 100644 --- a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedStatus.kt +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedStatus.kt @@ -16,11 +16,10 @@ import javax.validation.Valid import io.swagger.v3.oas.annotations.media.Schema /** -* additional field as Enum -* Values: ALLOWED,IN_PROGRESS,REJECTED -*/ + * additional field as Enum + * Values: ALLOWED,IN_PROGRESS,REJECTED + */ enum class MultipartMixedStatus(@get:JsonValue val value: kotlin.String) { - ALLOWED("ALLOWED"), IN_PROGRESS("IN_PROGRESS"), REJECTED("REJECTED"); @@ -29,9 +28,10 @@ enum class MultipartMixedStatus(@get:JsonValue val value: kotlin.String) { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): MultipartMixedStatus { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'MultipartMixedStatus'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum 'MultipartMixedStatus'" + ) } } } - diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Order.kt index c185ea107046..3ef0caae6927 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Pet.kt index d5959182a70f..28935d17621a 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/model/Pet.kt @@ -64,17 +64,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt index c185ea107046..3ef0caae6927 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Order.kt @@ -64,17 +64,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt index d5959182a70f..28935d17621a 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity/src/main/kotlin/org/openapitools/model/Pet.kt @@ -64,17 +64,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-paged-model/src/main/kotlin/org/openapitools/model/PetSort.kt b/samples/server/petstore/kotlin-springboot-paged-model/src/main/kotlin/org/openapitools/model/PetSort.kt index b4d4e2ee3a9d..f3345485a53a 100644 --- a/samples/server/petstore/kotlin-springboot-paged-model/src/main/kotlin/org/openapitools/model/PetSort.kt +++ b/samples/server/petstore/kotlin-springboot-paged-model/src/main/kotlin/org/openapitools/model/PetSort.kt @@ -15,11 +15,10 @@ import jakarta.validation.constraints.Size import jakarta.validation.Valid /** -* -* Values: idCommaAsc,idCommaDesc,nameCommaAsc,nameCommaDesc -*/ + * + * Values: idCommaAsc,idCommaDesc,nameCommaAsc,nameCommaDesc + */ enum class PetSort(@get:JsonValue val value: kotlin.String) : java.io.Serializable { - idCommaAsc("id,asc"), idCommaDesc("id,desc"), nameCommaAsc("name,asc"), @@ -29,9 +28,10 @@ enum class PetSort(@get:JsonValue val value: kotlin.String) : java.io.Serializab @JvmStatic @JsonCreator fun forValue(value: kotlin.String): PetSort { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'PetSort'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum 'PetSort'" + ) } } } - diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt index fc6ac8284963..1ba07c6a7b26 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt index 1466d9480ad8..627b004b5fae 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt index fc6ac8284963..1ba07c6a7b26 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt index 1466d9480ad8..627b004b5fae 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -72,17 +72,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt index f2c26ec7f2d9..9781dacc7dbe 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt index 09fe219134cc..e63adc6a06ac 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt @@ -71,17 +71,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSort.kt b/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSort.kt index 06ce004b5a90..0e0e3ca59f66 100644 --- a/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSort.kt +++ b/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSort.kt @@ -15,11 +15,10 @@ import jakarta.validation.constraints.Size import jakarta.validation.Valid /** -* -* Values: idCommaAsc,idCommaDesc,createdAtCommaAsc,createdAtCommaDesc -*/ + * + * Values: idCommaAsc,idCommaDesc,createdAtCommaAsc,createdAtCommaDesc + */ enum class PetSort(@get:JsonValue val value: kotlin.String) : java.io.Serializable { - idCommaAsc("id,asc"), idCommaDesc("id,desc"), createdAtCommaAsc("createdAt,asc"), @@ -29,9 +28,10 @@ enum class PetSort(@get:JsonValue val value: kotlin.String) : java.io.Serializab @JvmStatic @JsonCreator fun forValue(value: kotlin.String): PetSort { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'PetSort'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum 'PetSort'" + ) } } } - diff --git a/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSortEnum.kt b/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSortEnum.kt index a8bb6d27cbc9..33439e70831d 100644 --- a/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSortEnum.kt +++ b/samples/server/petstore/kotlin-springboot-sort-validation/src/main/kotlin/org/openapitools/model/PetSortEnum.kt @@ -15,11 +15,10 @@ import jakarta.validation.constraints.Size import jakarta.validation.Valid /** -* -* Values: nameCommaAsc,nameCommaDesc,idCommaAsc,idCommaDesc -*/ + * + * Values: nameCommaAsc,nameCommaDesc,idCommaAsc,idCommaDesc + */ enum class PetSortEnum(@get:JsonValue val value: kotlin.String) : java.io.Serializable { - nameCommaAsc("name,asc"), nameCommaDesc("name,desc"), idCommaAsc("id,asc"), @@ -29,9 +28,10 @@ enum class PetSortEnum(@get:JsonValue val value: kotlin.String) : java.io.Serial @JvmStatic @JsonCreator fun forValue(value: kotlin.String): PetSortEnum { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'PetSortEnum'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum 'PetSortEnum'" + ) } } } - diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt index 614fab54815b..91e9cc41e432 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt index 295de4980629..5c5a59ec34c9 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt @@ -71,17 +71,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt index df21eb4eb9a7..44b5af5745c4 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt index 3452e53fc80d..5e32426a0bc1 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt @@ -71,17 +71,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue val value: kotlin.String) { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt index 13da2b5afecf..30e0d5fc5230 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt @@ -16,11 +16,10 @@ import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** -* -* Values: black,white,brown,yellow,violet -*/ -enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDefaultMethods , java.io.Serializable { - + * + * Values: black,white,brown,yellow,violet + */ +enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDefaultMethods, java.io.Serializable { black("black"), white("white"), brown("brown"), @@ -31,9 +30,10 @@ enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDe @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Color { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Color'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException( + "Unexpected value '$value' for enum 'Color'" + ) } } } - diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt index 9ad790589a79..4637234ccca9 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt @@ -94,18 +94,18 @@ data class Dog( * Values: Dingo,Husky,Retriever,Shepherd */ enum class Breed(@get:JsonValue val value: kotlin.String) { - + Dingo("Dingo"), Husky("Husky"), Retriever("Retriever"), Shepherd("Shepherd"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Breed { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Breed'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Breed'") } } } diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt index f4f0ff415e06..59bdb195718a 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt @@ -71,17 +71,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue val value: kotlin.String) { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index 05b5fbbae3f3..7feea8e586e1 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -65,17 +65,17 @@ data class Order( * Values: placed,approved,delivered */ enum class Status(@get:JsonValue override val value: kotlin.String) : ValuedEnum { - + placed("placed"), approved("approved"), delivered("delivered"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index a94d6438c2b5..6f750fcc568d 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -65,17 +65,17 @@ data class Pet( * Values: available,pending,sold */ enum class Status(@get:JsonValue override val value: kotlin.String) : ValuedEnum { - + available("available"), pending("pending"), sold("sold"); - + companion object { @JvmStatic @JsonCreator fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") + return values().firstOrNull{ it.value == value } + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Status'") } } }