diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md index 54f8cb9f1c96..e8bcf88662cf 100644 --- a/docs/generators/kotlin-server.md +++ b/docs/generators/kotlin-server.md @@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |apiSuffix|suffix for api classes| |Api| |artifactId|Generated artifact id (name of jar).| |kotlin-server| |artifactVersion|Generated artifact's package version.| |1.0.0| -|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original| |featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true| |featureCORS|Ktor by default provides an interceptor for implementing proper support for Cross-Origin Resource Sharing (CORS). See enable-cors.org.| |false| |featureCompression|Adds ability to compress outgoing content using gzip, deflate or custom encoder and thus reduce size of the response.| |true| diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index f466d7ced80b..3df8e4781ff0 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -30,7 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |configPackage|configuration package for generated code| |org.openapitools.configuration| |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.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| -|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original| |exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true| |gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true| |groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools| diff --git a/docs/generators/kotlin-vertx.md b/docs/generators/kotlin-vertx.md index 738f4d8c9610..041b7a74087e 100644 --- a/docs/generators/kotlin-vertx.md +++ b/docs/generators/kotlin-vertx.md @@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |apiSuffix|suffix for api classes| |Api| |artifactId|Generated artifact id (name of jar).| |null| |artifactVersion|Generated artifact's package version.| |1.0.0| -|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original| |groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools| |modelMutable|Create mutable models| |false| |packageName|Generated artifact package name.| |org.openapitools| diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index 3ce910c7663a..136f31d18716 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -24,7 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |artifactVersion|Generated artifact's package version.| |1.0.0| |collectionType|Option. Collection type to use|
**array**
kotlin.Array
**list**
kotlin.collections.List
|list| |dateLibrary|Option. Date library to use|
**threetenbp-localdatetime**
Threetenbp - Backport of JSR310 (jvm only, for legacy app only)
**kotlinx-datetime**
kotlinx-datetime (preferred for multiplatform)
**string**
String
**java8-localdatetime**
Java 8 native JSR310 (jvm only, for legacy app only)
**java8**
Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)
**threetenbp**
Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)
|java8| -|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original| |generateRoomModels|Generate Android Room database models in addition to API models (JVM Volley library only)| |false| |groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools| |idea|Add IntellJ Idea plugin and mark Kotlin main and test folders as source folders.| |false| diff --git a/docs/generators/ktorm-schema.md b/docs/generators/ktorm-schema.md index f29302e8188b..8bbad926bc99 100644 --- a/docs/generators/ktorm-schema.md +++ b/docs/generators/ktorm-schema.md @@ -23,7 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |artifactId|Generated artifact id (name of jar).| |ktorm| |artifactVersion|Generated artifact's package version.| |1.0.0| |defaultDatabaseName|Default database name for all queries| |sqlite.db| -|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original| |groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools| |identifierNamingConvention|Naming convention of Ktorm identifiers(table names and column names). This is not related to database name which is defined by defaultDatabaseName option|
**original**
Do not transform original names
**snake_case**
Use snake_case names
|original| |importModelPackageName|Package name of the imported models| |org.openapitools.database.models| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index 3224e1cf5c91..83843142ae2d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -76,7 +76,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co protected boolean nonPublicApi = false; - protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase; + protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.original; // model classes cannot use the same property names defined in HashMap // ref: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-hash-map/ diff --git a/modules/openapi-generator/src/main/resources/asciidoc-documentation/model.mustache b/modules/openapi-generator/src/main/resources/asciidoc-documentation/model.mustache index 604d7d14c4a6..c861195b205d 100644 --- a/modules/openapi-generator/src/main/resources/asciidoc-documentation/model.mustache +++ b/modules/openapi-generator/src/main/resources/asciidoc-documentation/model.mustache @@ -9,20 +9,38 @@ {{unescapedDescription}} + +{{^allowableValues}} [.fields-{{classname}}] -[cols="2,1,2,4,1"] +[cols="2,1,1,2,4,1"] |=== -| Field Name| Required| Type| Description| Format +| Field Name| Required| Nullable | Type| Description | Format {{#vars}} | {{baseName}} | {{#required}}X{{/required}} -| {{dataType}} {{#isContainer}} of <<{{complexType}}>>{{/isContainer}} +| {{#isNullable}}X{{/isNullable}} +| {{#isModel}}<<{{ dataType }}>>{{/isModel}} {{^container}}{{^allowableValues}} {{^isModel}}{{ dataType }}{{/isModel}}{{/allowableValues}}{{#allowableValues}}{{^allowableValues.empty}}<<{{ dataType }}>>{{/allowableValues.empty}}{{/allowableValues}} {{/container}} {{#isContainer}} of <<{{complexType}}>>{{/isContainer}} | {{description}} -| {{{dataFormat}}} {{#isEnum}}_Enum:_ {{#_enum}}{{this}}, {{/_enum}}{{/isEnum}} +| {{{dataFormat}}} {{#isEnum}}_Enum:_ {{#_enum}}{{this}}, {{/_enum}}{{/isEnum}} {{^isEnum}}{{^container}}{{^allowableValues.empty}} {{#allowableValues.values}}{{this}}, {{/allowableValues.values}} {{/allowableValues.empty}}{{/container}}{{/isEnum}} {{/vars}} |=== +{{/allowableValues}} + +{{#allowableValues}} + +[.fields-{{classname}}] +[cols="1"] +|=== +| Enum Values + +{{#allowableValues.values}} +| {{this}} +{{/allowableValues.values}} + +|=== +{{/allowableValues}} {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java index b7d5c4aec123..374d1d08e614 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java @@ -16,6 +16,9 @@ import org.testng.annotations.Test; import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; @@ -278,9 +281,70 @@ public void testEnumPropertyWithDefaultValue() { // Assert the enum default value is properly generated CodegenProperty cp1 = cm1.vars.get(0); Assert.assertEquals(cp1.getEnumName(), "PropertyName"); - Assert.assertEquals(cp1.getDefaultValue(), "PropertyName.vALUE"); + Assert.assertEquals(cp1.getDefaultValue(), "PropertyName.VALUE"); } + @Test(description = "Issue #3804") + public void testEnumPropertyWithCapitalization() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml"); + final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen(); + + Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault"); + CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1); + + // We need to postProcess the model for enums to be processed + codegen.postProcessModels(createCodegenModelWrapper(cm1)); + + // Assert the enums are generated without changing capitalization + CodegenProperty cp0 = cm1.vars.get(0); + Assert.assertEquals(cp0.getEnumName(), "PropertyName"); + Assert.assertEquals(((HashMap)((ArrayList) cp0.getAllowableValues().get("enumVars")).get(0)).get("name"), "VALUE"); + CodegenProperty cp1 = cm1.vars.get(1); + Assert.assertEquals(cp1.getEnumName(), "PropertyName2"); + Assert.assertEquals(((HashMap)((ArrayList) cp1.getAllowableValues().get("enumVars")).get(0)).get("name"), "Value"); + CodegenProperty cp2 = cm1.vars.get(2); + Assert.assertEquals(cp2.getEnumName(), "PropertyName3"); + Assert.assertEquals(((HashMap)((ArrayList) cp2.getAllowableValues().get("enumVars")).get(0)).get("name"), "nonkeywordvalue"); + } + + @Test(description = "Issue #3804") + public void testEnumPropertyDefaultWithCapitalization() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml"); + final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen(); + + Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault"); + CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1); + + // We need to postProcess the model for enums to be processed + codegen.postProcessModels(createCodegenModelWrapper(cm1)); + + // Assert the enum default value is properly generated + CodegenProperty cp0 = cm1.vars.get(0); + Assert.assertEquals(cp0.getDefaultValue(), "PropertyName.VALUE"); + CodegenProperty cp1 = cm1.vars.get(1); + Assert.assertEquals(cp1.getDefaultValue(), "PropertyName2.Value"); + CodegenProperty cp2 = cm1.vars.get(2); + Assert.assertEquals(cp2.getDefaultValue(), "PropertyName3.nonkeywordvalue"); + } + + @Test(description = "Issue #3804") + public void testEnumPropertyWithKeyword() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml"); + final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen(); + + Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault"); + CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1); + + // We need to postProcess the model for enums to be processed + codegen.postProcessModels(createCodegenModelWrapper(cm1)); + + // Assert the enum default value is properly generated + CodegenProperty cp3 = cm1.vars.get(3); + Assert.assertEquals(cp3.getEnumName(), "PropertyName4"); + Assert.assertEquals(cp3.getDefaultValue(), "PropertyName4.`value`"); + } + + @Test(description = "Issue #10792") public void handleInheritanceWithObjectTypeShouldNotBeAMap() { Schema parent = new ObjectSchema() diff --git a/modules/openapi-generator/src/test/resources/3_0/asciidoc/api-docs.json b/modules/openapi-generator/src/test/resources/3_0/asciidoc/api-docs.json index 0ef296a8fb1a..f4c6c0b980c4 100644 --- a/modules/openapi-generator/src/test/resources/3_0/asciidoc/api-docs.json +++ b/modules/openapi-generator/src/test/resources/3_0/asciidoc/api-docs.json @@ -1399,9 +1399,21 @@ "items": { "$ref": "#/components/schemas/TaskWeek" } + }, + "pricingModelType":{ + "$ref": "#/components/schemas/PricingModelType" } }, "description": "week, holds all work and working assignments." + }, + "PricingModelType": { + "type": "string", + "enum": [ + "Unsupported", + "Flex", + "Community", + "Freedom" + ] } }, "securitySchemes": { diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml new file mode 100644 index 000000000000..2857e7fbf87a --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + title: 'Issue 10591 Enum default value' + version: latest +paths: + '/': + get: + operationId: operation + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ModelWithEnumPropertyHavingDefault' +components: + schemas: + ModelWithEnumPropertyHavingDefault: + required: + - propertyName + properties: + propertyName: + type: string + default: VALUE + enum: + - VALUE + propertyName2: + type: string + default: Value + enum: + - Value + propertyName3: + type: string + default: nonkeywordvalue + enum: + - nonkeywordvalue + propertyName4: + type: string + default: value + enum: + - value diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md index d61e16ef26b9..4fab0f82a3b6 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md @@ -10,7 +10,7 @@ * `unclassified` (value: `"unclassified"`) - * `unknownDefaultOpenApi` (value: `"unknown_default_open_api"`) + * `unknown_default_open_api` (value: `"unknown_default_open_api"`) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt index 894db93c77ed..2ebc26327828 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt @@ -65,13 +65,13 @@ data class DefaultValue ( /** * * - * Values: success,failure,unclassified,unknownDefaultOpenApi + * Values: success,failure,unclassified,unknown_default_open_api */ enum class ArrayStringEnumDefault(val value: kotlin.String) { @JsonProperty(value = "success") success("success"), @JsonProperty(value = "failure") failure("failure"), @JsonProperty(value = "unclassified") unclassified("unclassified"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt index 355a8d07b56b..e121711bca74 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -59,13 +59,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt index 679fc593962a..81d1a6a73ce7 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt @@ -41,13 +41,13 @@ data class Query ( /** * * - * Values: sUCCESS,fAILURE,sKIPPED,unknownDefaultOpenApi + * Values: SUCCESS,FAILURE,SKIPPED,unknown_default_open_api */ enum class Outcomes(val value: kotlin.String) { - @JsonProperty(value = "SUCCESS") sUCCESS("SUCCESS"), - @JsonProperty(value = "FAILURE") fAILURE("FAILURE"), - @JsonProperty(value = "SKIPPED") sKIPPED("SKIPPED"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "SUCCESS") SUCCESS("SUCCESS"), + @JsonProperty(value = "FAILURE") FAILURE("FAILURE"), + @JsonProperty(value = "SKIPPED") SKIPPED("SKIPPED"), + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt index e85cc978ab62..5c21a41e8aee 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt @@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty /** * * - * Values: success,failure,unclassified,unknownDefaultOpenApi + * Values: success,failure,unclassified,unknown_default_open_api */ enum class StringEnumRef(val value: kotlin.String) { @@ -36,7 +36,7 @@ enum class StringEnumRef(val value: kotlin.String) { unclassified("unclassified"), @JsonProperty(value = "unknown_default_open_api") - unknownDefaultOpenApi("unknown_default_open_api"); + unknown_default_open_api("unknown_default_open_api"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEnumRef.md b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEnumRef.md index d61e16ef26b9..4fab0f82a3b6 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEnumRef.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEnumRef.md @@ -10,7 +10,7 @@ * `unclassified` (value: `"unclassified"`) - * `unknownDefaultOpenApi` (value: `"unknown_default_open_api"`) + * `unknown_default_open_api` (value: `"unknown_default_open_api"`) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt index 894db93c77ed..2ebc26327828 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt @@ -65,13 +65,13 @@ data class DefaultValue ( /** * * - * Values: success,failure,unclassified,unknownDefaultOpenApi + * Values: success,failure,unclassified,unknown_default_open_api */ enum class ArrayStringEnumDefault(val value: kotlin.String) { @JsonProperty(value = "success") success("success"), @JsonProperty(value = "failure") failure("failure"), @JsonProperty(value = "unclassified") unclassified("unclassified"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt index 355a8d07b56b..e121711bca74 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -59,13 +59,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Query.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Query.kt index 679fc593962a..81d1a6a73ce7 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Query.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Query.kt @@ -41,13 +41,13 @@ data class Query ( /** * * - * Values: sUCCESS,fAILURE,sKIPPED,unknownDefaultOpenApi + * Values: SUCCESS,FAILURE,SKIPPED,unknown_default_open_api */ enum class Outcomes(val value: kotlin.String) { - @JsonProperty(value = "SUCCESS") sUCCESS("SUCCESS"), - @JsonProperty(value = "FAILURE") fAILURE("FAILURE"), - @JsonProperty(value = "SKIPPED") sKIPPED("SKIPPED"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "SUCCESS") SUCCESS("SUCCESS"), + @JsonProperty(value = "FAILURE") FAILURE("FAILURE"), + @JsonProperty(value = "SKIPPED") SKIPPED("SKIPPED"), + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt index e85cc978ab62..5c21a41e8aee 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt @@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty /** * * - * Values: success,failure,unclassified,unknownDefaultOpenApi + * Values: success,failure,unclassified,unknown_default_open_api */ enum class StringEnumRef(val value: kotlin.String) { @@ -36,7 +36,7 @@ enum class StringEnumRef(val value: kotlin.String) { unclassified("unclassified"), @JsonProperty(value = "unknown_default_open_api") - unknownDefaultOpenApi("unknown_default_open_api"); + unknown_default_open_api("unknown_default_open_api"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 751d87de7816..138966eedaf8 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -48,27 +48,27 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient * enum for parameter queryDefaultEnum */ enum class QueryDefaultEnumFindPetsByStatus(val value: kotlin.String) { - @Json(name = "A") a("A"), - @Json(name = "B") b("B"), - @Json(name = "C") c("C") + @Json(name = "A") A("A"), + @Json(name = "B") B("B"), + @Json(name = "C") C("C") } /** * enum for parameter headerDefaultEnum */ enum class HeaderDefaultEnumFindPetsByStatus(val value: kotlin.String) { - @Json(name = "A") a("A"), - @Json(name = "B") b("B"), - @Json(name = "C") c("C") + @Json(name = "A") A("A"), + @Json(name = "B") B("B"), + @Json(name = "C") C("C") } /** * enum for parameter cookieDefaultEnum */ enum class CookieDefaultEnumFindPetsByStatus(val value: kotlin.String) { - @Json(name = "A") a("A"), - @Json(name = "B") b("B"), - @Json(name = "C") c("C") + @Json(name = "A") A("A"), + @Json(name = "B") B("B"), + @Json(name = "C") C("C") } /** @@ -97,7 +97,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient * @throws ServerException If the API returns a server error response */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(pathDefault: kotlin.String, pathNullable: kotlin.String, queryDefault: kotlin.String? = "available", queryDefaultEnum: QueryDefaultEnumFindPetsByStatus? = QueryDefaultEnumFindPetsByStatus.b, queryDefaultInt: java.math.BigDecimal? = java.math.BigDecimal("3"), headerDefault: kotlin.String? = "available", headerDefaultEnum: HeaderDefaultEnumFindPetsByStatus? = HeaderDefaultEnumFindPetsByStatus.b, headerDefaultInt: java.math.BigDecimal? = java.math.BigDecimal("3"), cookieDefault: kotlin.String? = "available", cookieDefaultEnum: CookieDefaultEnumFindPetsByStatus? = CookieDefaultEnumFindPetsByStatus.b, cookieDefaultInt: java.math.BigDecimal? = java.math.BigDecimal("3"), queryNullable: kotlin.String? = null, headerNullable: kotlin.String? = null, cookieNullable: kotlin.String? = null, dollarQueryDollarDollarSign: kotlin.String? = null) : Unit { + fun findPetsByStatus(pathDefault: kotlin.String, pathNullable: kotlin.String, queryDefault: kotlin.String? = "available", queryDefaultEnum: QueryDefaultEnumFindPetsByStatus? = QueryDefaultEnumFindPetsByStatus.B, queryDefaultInt: java.math.BigDecimal? = java.math.BigDecimal("3"), headerDefault: kotlin.String? = "available", headerDefaultEnum: HeaderDefaultEnumFindPetsByStatus? = HeaderDefaultEnumFindPetsByStatus.B, headerDefaultInt: java.math.BigDecimal? = java.math.BigDecimal("3"), cookieDefault: kotlin.String? = "available", cookieDefaultEnum: CookieDefaultEnumFindPetsByStatus? = CookieDefaultEnumFindPetsByStatus.B, cookieDefaultInt: java.math.BigDecimal? = java.math.BigDecimal("3"), queryNullable: kotlin.String? = null, headerNullable: kotlin.String? = null, cookieNullable: kotlin.String? = null, dollarQueryDollarDollarSign: kotlin.String? = null) : Unit { val localVarResponse = findPetsByStatusWithHttpInfo(pathDefault = pathDefault, pathNullable = pathNullable, queryDefault = queryDefault, queryDefaultEnum = queryDefaultEnum, queryDefaultInt = queryDefaultInt, headerDefault = headerDefault, headerDefaultEnum = headerDefaultEnum, headerDefaultInt = headerDefaultInt, cookieDefault = cookieDefault, cookieDefaultEnum = cookieDefaultEnum, cookieDefaultInt = cookieDefaultInt, queryNullable = queryNullable, headerNullable = headerNullable, cookieNullable = cookieNullable, dollarQueryDollarDollarSign = dollarQueryDollarDollarSign) return when (localVarResponse.responseType) { diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt index 22bead5fec8c..aae522c65f63 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt @@ -7,12 +7,12 @@ object SerializerHelper { fun addEnumUnknownDefaultCase(moshiBuilder: Moshi.Builder): Moshi.Builder { return moshiBuilder .add(org.openapitools.client.models.ModelWithEnumPropertyHavingDefault.PropertyName::class.java, EnumJsonAdapter.create(org.openapitools.client.models.ModelWithEnumPropertyHavingDefault.PropertyName::class.java) - .withUnknownFallback(org.openapitools.client.models.ModelWithEnumPropertyHavingDefault.PropertyName.unknownDefaultOpenApi)) + .withUnknownFallback(org.openapitools.client.models.ModelWithEnumPropertyHavingDefault.PropertyName.unknown_default_open_api)) .add(org.openapitools.client.models.PropertyOfDay.DaysOfWeek::class.java, EnumJsonAdapter.create(org.openapitools.client.models.PropertyOfDay.DaysOfWeek::class.java) - .withUnknownFallback(org.openapitools.client.models.PropertyOfDay.DaysOfWeek.unknownDefaultOpenApi)) + .withUnknownFallback(org.openapitools.client.models.PropertyOfDay.DaysOfWeek.unknown_default_open_api)) .add(org.openapitools.client.models.PropertyOfDay.MonthOfYear::class.java, EnumJsonAdapter.create(org.openapitools.client.models.PropertyOfDay.MonthOfYear::class.java) - .withUnknownFallback(org.openapitools.client.models.PropertyOfDay.MonthOfYear.unknownDefaultOpenApi)) + .withUnknownFallback(org.openapitools.client.models.PropertyOfDay.MonthOfYear.unknown_default_open_api)) .add(org.openapitools.client.models.PropertyOfDay.HolidayTypes::class.java, EnumJsonAdapter.create(org.openapitools.client.models.PropertyOfDay.HolidayTypes::class.java) - .withUnknownFallback(org.openapitools.client.models.PropertyOfDay.HolidayTypes.unknownDefaultOpenApi)) + .withUnknownFallback(org.openapitools.client.models.PropertyOfDay.HolidayTypes.unknown_default_open_api)) } } diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt index 357b2b0172c6..7e80dc4cb1ff 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/ModelWithEnumPropertyHavingDefault.kt @@ -30,7 +30,7 @@ import java.io.Serializable data class ModelWithEnumPropertyHavingDefault ( @Json(name = "propertyName") - val propertyName: ModelWithEnumPropertyHavingDefault.PropertyName = PropertyName.vALUE + val propertyName: ModelWithEnumPropertyHavingDefault.PropertyName = PropertyName.VALUE ) : Serializable { companion object { @@ -40,12 +40,12 @@ data class ModelWithEnumPropertyHavingDefault ( /** * * - * Values: vALUE,unknownDefaultOpenApi + * Values: VALUE,unknown_default_open_api */ @JsonClass(generateAdapter = false) enum class PropertyName(val value: kotlin.String) { - @Json(name = "VALUE") vALUE("VALUE"), - @Json(name = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api"); + @Json(name = "VALUE") VALUE("VALUE"), + @Json(name = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/PropertyOfDay.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/PropertyOfDay.kt index 87a592b41cce..08053669c734 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/PropertyOfDay.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/models/PropertyOfDay.kt @@ -66,26 +66,26 @@ data class PropertyOfDay ( /** * Days of week * - * Values: mONDAY,tUESDAY,wEDNESDAY,tHURSDAY,fRIDAY,sATURDAY,sUNDAY,wEEKDAYS,wEEKEND,eVERYDAY,unknownDefaultOpenApi + * Values: MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY,WEEKDAYS,WEEKEND,EVERYDAY,unknown_default_open_api */ @JsonClass(generateAdapter = false) enum class DaysOfWeek(val value: kotlin.Any) { - @Json(name = "MONDAY") mONDAY("MONDAY"), - @Json(name = "TUESDAY") tUESDAY("TUESDAY"), - @Json(name = "WEDNESDAY") wEDNESDAY("WEDNESDAY"), - @Json(name = "THURSDAY") tHURSDAY("THURSDAY"), - @Json(name = "FRIDAY") fRIDAY("FRIDAY"), - @Json(name = "SATURDAY") sATURDAY("SATURDAY"), - @Json(name = "SUNDAY") sUNDAY("SUNDAY"), - @Json(name = "WEEKDAYS") wEEKDAYS("WEEKDAYS"), - @Json(name = "WEEKEND") wEEKEND("WEEKEND"), - @Json(name = "EVERYDAY") eVERYDAY("EVERYDAY"), - @Json(name = "11184809") unknownDefaultOpenApi("11184809"); + @Json(name = "MONDAY") MONDAY("MONDAY"), + @Json(name = "TUESDAY") TUESDAY("TUESDAY"), + @Json(name = "WEDNESDAY") WEDNESDAY("WEDNESDAY"), + @Json(name = "THURSDAY") THURSDAY("THURSDAY"), + @Json(name = "FRIDAY") FRIDAY("FRIDAY"), + @Json(name = "SATURDAY") SATURDAY("SATURDAY"), + @Json(name = "SUNDAY") SUNDAY("SUNDAY"), + @Json(name = "WEEKDAYS") WEEKDAYS("WEEKDAYS"), + @Json(name = "WEEKEND") WEEKEND("WEEKEND"), + @Json(name = "EVERYDAY") EVERYDAY("EVERYDAY"), + @Json(name = "11184809") unknown_default_open_api("11184809"); } /** * Month of year * - * Values: _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,unknownDefaultOpenApi + * Values: _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,unknown_default_open_api */ @JsonClass(generateAdapter = false) enum class MonthOfYear(val value: kotlin.Int) { @@ -101,35 +101,35 @@ data class PropertyOfDay ( @Json(name = "10") _10(10), @Json(name = "11") _11(11), @Json(name = "12") _12(12), - @Json(name = "11184809") unknownDefaultOpenApi(11184809); + @Json(name = "11184809") unknown_default_open_api(11184809); } /** * Holiday types * - * Values: nOTHOLIDAY,lOCALHOLIDAY,nATIONALHOLIDAY,aNYHOLIDAY,wORKINGDAY,aNYDAY,nEWYEARSDAY,pALMSUNDAY,mAUNDYTHURSDAY,gOODFRIDAY,eASTERSUNDAY,eASTERMONDAY,lABOURDAY,cONSTITUTIONDAY,aSCENSIONDAY,wHITSUNDAY,wHITMONDAY,XMAS_DAY,bOXINGDAY,unknownDefaultOpenApi + * Values: NOT_HOLIDAY,LOCAL_HOLIDAY,NATIONAL_HOLIDAY,ANY_HOLIDAY,WORKING_DAY,ANY_DAY,NEW_YEARS_DAY,PALM_SUNDAY,MAUNDY_THURSDAY,GOOD_FRIDAY,EASTER_SUNDAY,EASTER_MONDAY,LABOUR_DAY,CONSTITUTION_DAY,ASCENSION_DAY,WHIT_SUNDAY,WHIT_MONDAY,XMAS_DAY,BOXING_DAY,unknown_default_open_api */ @JsonClass(generateAdapter = false) enum class HolidayTypes(val value: kotlin.Any) { - @Json(name = "NOT_HOLIDAY") nOTHOLIDAY("NOT_HOLIDAY"), - @Json(name = "LOCAL_HOLIDAY") lOCALHOLIDAY("LOCAL_HOLIDAY"), - @Json(name = "NATIONAL_HOLIDAY") nATIONALHOLIDAY("NATIONAL_HOLIDAY"), - @Json(name = "ANY_HOLIDAY") aNYHOLIDAY("ANY_HOLIDAY"), - @Json(name = "WORKING_DAY") wORKINGDAY("WORKING_DAY"), - @Json(name = "ANY_DAY") aNYDAY("ANY_DAY"), - @Json(name = "NEW_YEARS_DAY") nEWYEARSDAY("NEW_YEARS_DAY"), - @Json(name = "PALM_SUNDAY") pALMSUNDAY("PALM_SUNDAY"), - @Json(name = "MAUNDY_THURSDAY") mAUNDYTHURSDAY("MAUNDY_THURSDAY"), - @Json(name = "GOOD_FRIDAY") gOODFRIDAY("GOOD_FRIDAY"), - @Json(name = "EASTER_SUNDAY") eASTERSUNDAY("EASTER_SUNDAY"), - @Json(name = "EASTER_MONDAY") eASTERMONDAY("EASTER_MONDAY"), - @Json(name = "LABOUR_DAY") lABOURDAY("LABOUR_DAY"), - @Json(name = "CONSTITUTION_DAY") cONSTITUTIONDAY("CONSTITUTION_DAY"), - @Json(name = "ASCENSION_DAY") aSCENSIONDAY("ASCENSION_DAY"), - @Json(name = "WHIT_SUNDAY") wHITSUNDAY("WHIT_SUNDAY"), - @Json(name = "WHIT_MONDAY") wHITMONDAY("WHIT_MONDAY"), + @Json(name = "NOT_HOLIDAY") NOT_HOLIDAY("NOT_HOLIDAY"), + @Json(name = "LOCAL_HOLIDAY") LOCAL_HOLIDAY("LOCAL_HOLIDAY"), + @Json(name = "NATIONAL_HOLIDAY") NATIONAL_HOLIDAY("NATIONAL_HOLIDAY"), + @Json(name = "ANY_HOLIDAY") ANY_HOLIDAY("ANY_HOLIDAY"), + @Json(name = "WORKING_DAY") WORKING_DAY("WORKING_DAY"), + @Json(name = "ANY_DAY") ANY_DAY("ANY_DAY"), + @Json(name = "NEW_YEARS_DAY") NEW_YEARS_DAY("NEW_YEARS_DAY"), + @Json(name = "PALM_SUNDAY") PALM_SUNDAY("PALM_SUNDAY"), + @Json(name = "MAUNDY_THURSDAY") MAUNDY_THURSDAY("MAUNDY_THURSDAY"), + @Json(name = "GOOD_FRIDAY") GOOD_FRIDAY("GOOD_FRIDAY"), + @Json(name = "EASTER_SUNDAY") EASTER_SUNDAY("EASTER_SUNDAY"), + @Json(name = "EASTER_MONDAY") EASTER_MONDAY("EASTER_MONDAY"), + @Json(name = "LABOUR_DAY") LABOUR_DAY("LABOUR_DAY"), + @Json(name = "CONSTITUTION_DAY") CONSTITUTION_DAY("CONSTITUTION_DAY"), + @Json(name = "ASCENSION_DAY") ASCENSION_DAY("ASCENSION_DAY"), + @Json(name = "WHIT_SUNDAY") WHIT_SUNDAY("WHIT_SUNDAY"), + @Json(name = "WHIT_MONDAY") WHIT_MONDAY("WHIT_MONDAY"), @Json(name = "CHRISTMAS_DAY") XMAS_DAY("CHRISTMAS_DAY"), - @Json(name = "BOXING_DAY") bOXINGDAY("BOXING_DAY"), - @Json(name = "11184809") unknownDefaultOpenApi("11184809"); + @Json(name = "BOXING_DAY") BOXING_DAY("BOXING_DAY"), + @Json(name = "11184809") unknown_default_open_api("11184809"); } } diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt index 10faddb662d3..be99a7f34829 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -66,14 +66,14 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ @Serializable(with = OrderSerializer::class) enum class Status(val value: kotlin.String) { @SerialName(value = "placed") placed("placed"), @SerialName(value = "approved") approved("approved"), @SerialName(value = "delivered") delivered("delivered"), - @SerialName(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api"); + @SerialName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); } @Serializer(forClass = Status::class) @@ -83,7 +83,7 @@ data class Order ( override fun deserialize(decoder: Decoder): Status { val value = decoder.decodeSerializableValue(kotlin.String.serializer()) return Status.values().firstOrNull { it.value == value } - ?: Status.unknownDefaultOpenApi + ?: Status.unknown_default_open_api } override fun serialize(encoder: Encoder, value: Status) { diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index 319d5b237c38..1f70e4317dd8 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -68,14 +68,14 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ @Serializable(with = PetSerializer::class) enum class Status(val value: kotlin.String) { @SerialName(value = "available") available("available"), @SerialName(value = "pending") pending("pending"), @SerialName(value = "sold") sold("sold"), - @SerialName(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api"); + @SerialName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); } @Serializer(forClass = Status::class) @@ -85,7 +85,7 @@ data class Pet ( override fun deserialize(decoder: Decoder): Status { val value = decoder.decodeSerializableValue(kotlin.String.serializer()) return Status.values().firstOrNull { it.value == value } - ?: Status.unknownDefaultOpenApi + ?: Status.unknown_default_open_api } override fun serialize(encoder: Encoder, value: Status) { diff --git a/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt index 01008523bcb8..ded639bcd589 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -57,13 +57,13 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "placed") placed("placed"), @JsonProperty(value = "approved") approved("approved"), @JsonProperty(value = "delivered") delivered("delivered"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt index 17abefb22caf..62240499eb93 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -60,13 +60,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Order.kt index 13d33912dc02..5c99ae176b00 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -56,13 +56,13 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @SerializedName(value = "placed") placed("placed"), @SerializedName(value = "approved") approved("approved"), @SerializedName(value = "delivered") delivered("delivered"), - @SerializedName(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api"); + @SerializedName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt index 3d52e65fa750..3cedacbde972 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -58,13 +58,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @SerializedName(value = "available") available("available"), @SerializedName(value = "pending") pending("pending"), @SerializedName(value = "sold") sold("sold"), - @SerializedName(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api"); + @SerializedName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt index 01008523bcb8..ded639bcd589 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -57,13 +57,13 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "placed") placed("placed"), @JsonProperty(value = "approved") approved("approved"), @JsonProperty(value = "delivered") delivered("delivered"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt index aa4e724e0e69..2aafc065fafc 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -59,13 +59,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt index 01008523bcb8..ded639bcd589 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -57,13 +57,13 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "placed") placed("placed"), @JsonProperty(value = "approved") approved("approved"), @JsonProperty(value = "delivered") delivered("delivered"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt index 17abefb22caf..62240499eb93 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -60,13 +60,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Order.kt index 01008523bcb8..ded639bcd589 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -57,13 +57,13 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "placed") placed("placed"), @JsonProperty(value = "approved") approved("approved"), @JsonProperty(value = "delivered") delivered("delivered"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt index 17abefb22caf..62240499eb93 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -60,13 +60,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt index 01008523bcb8..ded639bcd589 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -57,13 +57,13 @@ data class Order ( /** * Order Status * - * Values: placed,approved,delivered,unknownDefaultOpenApi + * Values: placed,approved,delivered,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "placed") placed("placed"), @JsonProperty(value = "approved") approved("approved"), @JsonProperty(value = "delivered") delivered("delivered"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt index 17abefb22caf..62240499eb93 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -60,13 +60,13 @@ data class Pet ( /** * pet status in the store * - * Values: available,pending,sold,unknownDefaultOpenApi + * Values: available,pending,sold,unknown_default_open_api */ enum class Status(val value: kotlin.String) { @JsonProperty(value = "available") available("available"), @JsonProperty(value = "pending") pending("pending"), @JsonProperty(value = "sold") sold("sold"), - @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api"); } } diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt new file mode 100644 index 000000000000..e39a6e70463f --- /dev/null +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/SerializerHelper.kt @@ -0,0 +1,14 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.Moshi +import com.squareup.moshi.adapters.EnumJsonAdapter + +object SerializerHelper { + fun addEnumUnknownDefaultCase(moshiBuilder: Moshi.Builder): Moshi.Builder { + return moshiBuilder + .add(org.openapitools.client.models.Order.Status::class.java, EnumJsonAdapter.create(org.openapitools.client.models.Order.Status::class.java) + .withUnknownFallback(org.openapitools.client.models.Order.Status.unknown_default_open_api)) + .add(org.openapitools.client.models.Pet.Status::class.java, EnumJsonAdapter.create(org.openapitools.client.models.Pet.Status::class.java) + .withUnknownFallback(org.openapitools.client.models.Pet.Status.unknown_default_open_api)) + } +} diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt new file mode 100644 index 000000000000..d706c19b9aa1 --- /dev/null +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -0,0 +1,70 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * An order for a pets from the pet store + * + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ + + +data class Order ( + + @Json(name = "id") + val id: kotlin.Long? = null, + + @Json(name = "petId") + val petId: kotlin.Long? = null, + + @Json(name = "quantity") + val quantity: kotlin.Int? = null, + + @Json(name = "shipDate") + val shipDate: java.time.OffsetDateTime? = null, + + /* Order Status */ + @Json(name = "status") + val status: Order.Status? = null, + + @Json(name = "complete") + val complete: kotlin.Boolean? = false + +) { + + /** + * Order Status + * + * Values: placed,approved,delivered,unknown_default_open_api + */ + @JsonClass(generateAdapter = false) + enum class Status(val value: kotlin.String) { + @Json(name = "placed") placed("placed"), + @Json(name = "approved") approved("approved"), + @Json(name = "delivered") delivered("delivered"), + @Json(name = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); + } +} +