Skip to content

Commit 494fc7d

Browse files
wing328snowe2010jarin
authored
[kotlin] Enum should match spec (#18062)
* [kotlin] Enum should match spec Adjust the enum generation to match what is in the spec, rather than camel-casing it. Add tests for capitalization scenarios, including for kotlin keywords * [kotlin] export docs generators for enum change * [kotlin] export docs generators for enum change * fix conflicts --------- Co-authored-by: Tyler B. Thrailkill <[email protected]> Co-authored-by: Jari Nystedt <[email protected]>
1 parent 81e33ed commit 494fc7d

File tree

40 files changed

+336
-117
lines changed

40 files changed

+336
-117
lines changed

docs/generators/kotlin-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2222
|apiSuffix|suffix for api classes| |Api|
2323
|artifactId|Generated artifact id (name of jar).| |kotlin-server|
2424
|artifactVersion|Generated artifact's package version.| |1.0.0|
25-
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
25+
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
2626
|featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true|
2727
|featureCORS|Ktor by default provides an interceptor for implementing proper support for Cross-Origin Resource Sharing (CORS). See enable-cors.org.| |false|
2828
|featureCompression|Adds ability to compress outgoing content using gzip, deflate or custom encoder and thus reduce size of the response.| |true|

docs/generators/kotlin-spring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
3030
|configPackage|configuration package for generated code| |org.openapitools.configuration|
3131
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
3232
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**source**</dt><dd>Publish the original input OpenAPI specification.</dd><dt>**springfox**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.</dd><dt>**springdoc**</dt><dd>Generate an OpenAPI 3 specification using SpringDoc.</dd></dl>|springdoc|
33-
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
33+
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
3434
|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true|
3535
|gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true|
3636
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|

docs/generators/kotlin-vertx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2222
|apiSuffix|suffix for api classes| |Api|
2323
|artifactId|Generated artifact id (name of jar).| |null|
2424
|artifactVersion|Generated artifact's package version.| |1.0.0|
25-
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
25+
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
2626
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
2727
|modelMutable|Create mutable models| |false|
2828
|packageName|Generated artifact package name.| |org.openapitools|

docs/generators/kotlin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2424
|artifactVersion|Generated artifact's package version.| |1.0.0|
2525
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd></dl>|list|
2626
|dateLibrary|Option. Date library to use|<dl><dt>**threetenbp-localdatetime**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, for legacy app only)</dd><dt>**kotlinx-datetime**</dt><dd>kotlinx-datetime (preferred for multiplatform)</dd><dt>**string**</dt><dd>String</dd><dt>**java8-localdatetime**</dt><dd>Java 8 native JSR310 (jvm only, for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)</dd><dt>**threetenbp**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, preferred for jdk &lt; 1.8)</dd></dl>|java8|
27-
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
27+
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
2828
|generateRoomModels|Generate Android Room database models in addition to API models (JVM Volley library only)| |false|
2929
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
3030
|idea|Add IntellJ Idea plugin and mark Kotlin main and test folders as source folders.| |false|

docs/generators/ktorm-schema.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2323
|artifactId|Generated artifact id (name of jar).| |ktorm|
2424
|artifactVersion|Generated artifact's package version.| |1.0.0|
2525
|defaultDatabaseName|Default database name for all queries| |sqlite.db|
26-
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
26+
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
2727
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
2828
|identifierNamingConvention|Naming convention of Ktorm identifiers(table names and column names). This is not related to database name which is defined by defaultDatabaseName option|<dl><dt>**original**</dt><dd>Do not transform original names</dd><dt>**snake_case**</dt><dd>Use snake_case names</dd></dl>|original|
2929
|importModelPackageName|Package name of the imported models| |org.openapitools.database.models|

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
7676

7777
protected boolean nonPublicApi = false;
7878

79-
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
79+
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.original;
8080

8181
// model classes cannot use the same property names defined in HashMap
8282
// ref: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-hash-map/

modules/openapi-generator/src/main/resources/asciidoc-documentation/model.mustache

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,38 @@
99

1010
{{unescapedDescription}}
1111

12+
13+
{{^allowableValues}}
1214
[.fields-{{classname}}]
13-
[cols="2,1,2,4,1"]
15+
[cols="2,1,1,2,4,1"]
1416
|===
15-
| Field Name| Required| Type| Description| Format
17+
| Field Name| Required| Nullable | Type| Description | Format
1618

1719
{{#vars}}
1820
| {{baseName}}
1921
| {{#required}}X{{/required}}
20-
| {{dataType}} {{#isContainer}} of <<{{complexType}}>>{{/isContainer}}
22+
| {{#isNullable}}X{{/isNullable}}
23+
| {{#isModel}}<<{{ dataType }}>>{{/isModel}} {{^container}}{{^allowableValues}} {{^isModel}}{{ dataType }}{{/isModel}}{{/allowableValues}}{{#allowableValues}}{{^allowableValues.empty}}<<{{ dataType }}>>{{/allowableValues.empty}}{{/allowableValues}} {{/container}} {{#isContainer}} of <<{{complexType}}>>{{/isContainer}}
2124
| {{description}}
22-
| {{{dataFormat}}} {{#isEnum}}_Enum:_ {{#_enum}}{{this}}, {{/_enum}}{{/isEnum}}
25+
| {{{dataFormat}}} {{#isEnum}}_Enum:_ {{#_enum}}{{this}}, {{/_enum}}{{/isEnum}} {{^isEnum}}{{^container}}{{^allowableValues.empty}} {{#allowableValues.values}}{{this}}, {{/allowableValues.values}} {{/allowableValues.empty}}{{/container}}{{/isEnum}}
2326

2427
{{/vars}}
2528
|===
29+
{{/allowableValues}}
30+
31+
{{#allowableValues}}
32+
33+
[.fields-{{classname}}]
34+
[cols="1"]
35+
|===
36+
| Enum Values
37+
38+
{{#allowableValues.values}}
39+
| {{this}}
40+
{{/allowableValues.values}}
41+
42+
|===
43+
{{/allowableValues}}
2644

2745
{{/model}}
2846
{{/models}}

modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import org.testng.annotations.Test;
1717

1818
import java.io.File;
19+
import java.util.ArrayList;
20+
import java.util.Collections;
21+
import java.util.HashMap;
1922
import java.util.Map;
2023
import java.util.function.Function;
2124
import java.util.stream.Collectors;
@@ -278,9 +281,70 @@ public void testEnumPropertyWithDefaultValue() {
278281
// Assert the enum default value is properly generated
279282
CodegenProperty cp1 = cm1.vars.get(0);
280283
Assert.assertEquals(cp1.getEnumName(), "PropertyName");
281-
Assert.assertEquals(cp1.getDefaultValue(), "PropertyName.vALUE");
284+
Assert.assertEquals(cp1.getDefaultValue(), "PropertyName.VALUE");
282285
}
283286

287+
@Test(description = "Issue #3804")
288+
public void testEnumPropertyWithCapitalization() {
289+
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml");
290+
final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen();
291+
292+
Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault");
293+
CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1);
294+
295+
// We need to postProcess the model for enums to be processed
296+
codegen.postProcessModels(createCodegenModelWrapper(cm1));
297+
298+
// Assert the enums are generated without changing capitalization
299+
CodegenProperty cp0 = cm1.vars.get(0);
300+
Assert.assertEquals(cp0.getEnumName(), "PropertyName");
301+
Assert.assertEquals(((HashMap)((ArrayList) cp0.getAllowableValues().get("enumVars")).get(0)).get("name"), "VALUE");
302+
CodegenProperty cp1 = cm1.vars.get(1);
303+
Assert.assertEquals(cp1.getEnumName(), "PropertyName2");
304+
Assert.assertEquals(((HashMap)((ArrayList) cp1.getAllowableValues().get("enumVars")).get(0)).get("name"), "Value");
305+
CodegenProperty cp2 = cm1.vars.get(2);
306+
Assert.assertEquals(cp2.getEnumName(), "PropertyName3");
307+
Assert.assertEquals(((HashMap)((ArrayList) cp2.getAllowableValues().get("enumVars")).get(0)).get("name"), "nonkeywordvalue");
308+
}
309+
310+
@Test(description = "Issue #3804")
311+
public void testEnumPropertyDefaultWithCapitalization() {
312+
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml");
313+
final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen();
314+
315+
Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault");
316+
CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1);
317+
318+
// We need to postProcess the model for enums to be processed
319+
codegen.postProcessModels(createCodegenModelWrapper(cm1));
320+
321+
// Assert the enum default value is properly generated
322+
CodegenProperty cp0 = cm1.vars.get(0);
323+
Assert.assertEquals(cp0.getDefaultValue(), "PropertyName.VALUE");
324+
CodegenProperty cp1 = cm1.vars.get(1);
325+
Assert.assertEquals(cp1.getDefaultValue(), "PropertyName2.Value");
326+
CodegenProperty cp2 = cm1.vars.get(2);
327+
Assert.assertEquals(cp2.getDefaultValue(), "PropertyName3.nonkeywordvalue");
328+
}
329+
330+
@Test(description = "Issue #3804")
331+
public void testEnumPropertyWithKeyword() {
332+
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/issue3804-enum-enum-capitalization.yaml");
333+
final AbstractKotlinCodegen codegen = new P_AbstractKotlinCodegen();
334+
335+
Schema test1 = openAPI.getComponents().getSchemas().get("ModelWithEnumPropertyHavingDefault");
336+
CodegenModel cm1 = codegen.fromModel("ModelWithEnumPropertyHavingDefault", test1);
337+
338+
// We need to postProcess the model for enums to be processed
339+
codegen.postProcessModels(createCodegenModelWrapper(cm1));
340+
341+
// Assert the enum default value is properly generated
342+
CodegenProperty cp3 = cm1.vars.get(3);
343+
Assert.assertEquals(cp3.getEnumName(), "PropertyName4");
344+
Assert.assertEquals(cp3.getDefaultValue(), "PropertyName4.`value`");
345+
}
346+
347+
284348
@Test(description = "Issue #10792")
285349
public void handleInheritanceWithObjectTypeShouldNotBeAMap() {
286350
Schema parent = new ObjectSchema()

modules/openapi-generator/src/test/resources/3_0/asciidoc/api-docs.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,9 +1399,21 @@
13991399
"items": {
14001400
"$ref": "#/components/schemas/TaskWeek"
14011401
}
1402+
},
1403+
"pricingModelType":{
1404+
"$ref": "#/components/schemas/PricingModelType"
14021405
}
14031406
},
14041407
"description": "week, holds all work and working assignments."
1408+
},
1409+
"PricingModelType": {
1410+
"type": "string",
1411+
"enum": [
1412+
"Unsupported",
1413+
"Flex",
1414+
"Community",
1415+
"Freedom"
1416+
]
14051417
}
14061418
},
14071419
"securitySchemes": {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
openapi: 3.0.0
2+
info:
3+
title: 'Issue 10591 Enum default value'
4+
version: latest
5+
paths:
6+
'/':
7+
get:
8+
operationId: operation
9+
responses:
10+
'200':
11+
description: Success
12+
content:
13+
application/json:
14+
schema:
15+
$ref: '#/components/schemas/ModelWithEnumPropertyHavingDefault'
16+
components:
17+
schemas:
18+
ModelWithEnumPropertyHavingDefault:
19+
required:
20+
- propertyName
21+
properties:
22+
propertyName:
23+
type: string
24+
default: VALUE
25+
enum:
26+
- VALUE
27+
propertyName2:
28+
type: string
29+
default: Value
30+
enum:
31+
- Value
32+
propertyName3:
33+
type: string
34+
default: nonkeywordvalue
35+
enum:
36+
- nonkeywordvalue
37+
propertyName4:
38+
type: string
39+
default: value
40+
enum:
41+
- value

samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
* `unclassified` (value: `"unclassified"`)
1212

13-
* `unknownDefaultOpenApi` (value: `"unknown_default_open_api"`)
13+
* `unknown_default_open_api` (value: `"unknown_default_open_api"`)
1414

1515

1616

samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ data class DefaultValue (
6565
/**
6666
*
6767
*
68-
* Values: success,failure,unclassified,unknownDefaultOpenApi
68+
* Values: success,failure,unclassified,unknown_default_open_api
6969
*/
7070
enum class ArrayStringEnumDefault(val value: kotlin.String) {
7171
@JsonProperty(value = "success") success("success"),
7272
@JsonProperty(value = "failure") failure("failure"),
7373
@JsonProperty(value = "unclassified") unclassified("unclassified"),
74-
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
74+
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api");
7575
}
7676
}
7777

samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ data class Pet (
5959
/**
6060
* pet status in the store
6161
*
62-
* Values: available,pending,sold,unknownDefaultOpenApi
62+
* Values: available,pending,sold,unknown_default_open_api
6363
*/
6464
enum class Status(val value: kotlin.String) {
6565
@JsonProperty(value = "available") available("available"),
6666
@JsonProperty(value = "pending") pending("pending"),
6767
@JsonProperty(value = "sold") sold("sold"),
68-
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
68+
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api");
6969
}
7070
}
7171

samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ data class Query (
4141
/**
4242
*
4343
*
44-
* Values: sUCCESS,fAILURE,sKIPPED,unknownDefaultOpenApi
44+
* Values: SUCCESS,FAILURE,SKIPPED,unknown_default_open_api
4545
*/
4646
enum class Outcomes(val value: kotlin.String) {
47-
@JsonProperty(value = "SUCCESS") sUCCESS("SUCCESS"),
48-
@JsonProperty(value = "FAILURE") fAILURE("FAILURE"),
49-
@JsonProperty(value = "SKIPPED") sKIPPED("SKIPPED"),
50-
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
47+
@JsonProperty(value = "SUCCESS") SUCCESS("SUCCESS"),
48+
@JsonProperty(value = "FAILURE") FAILURE("FAILURE"),
49+
@JsonProperty(value = "SKIPPED") SKIPPED("SKIPPED"),
50+
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api");
5151
}
5252
}
5353

samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
2121
/**
2222
*
2323
*
24-
* Values: success,failure,unclassified,unknownDefaultOpenApi
24+
* Values: success,failure,unclassified,unknown_default_open_api
2525
*/
2626

2727
enum class StringEnumRef(val value: kotlin.String) {
@@ -36,7 +36,7 @@ enum class StringEnumRef(val value: kotlin.String) {
3636
unclassified("unclassified"),
3737

3838
@JsonProperty(value = "unknown_default_open_api")
39-
unknownDefaultOpenApi("unknown_default_open_api");
39+
unknown_default_open_api("unknown_default_open_api");
4040

4141
/**
4242
* Override [toString()] to avoid using the enum variable name as the value, and instead use

samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEnumRef.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
* `unclassified` (value: `"unclassified"`)
1212

13-
* `unknownDefaultOpenApi` (value: `"unknown_default_open_api"`)
13+
* `unknown_default_open_api` (value: `"unknown_default_open_api"`)
1414

1515

1616

samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ data class DefaultValue (
6565
/**
6666
*
6767
*
68-
* Values: success,failure,unclassified,unknownDefaultOpenApi
68+
* Values: success,failure,unclassified,unknown_default_open_api
6969
*/
7070
enum class ArrayStringEnumDefault(val value: kotlin.String) {
7171
@JsonProperty(value = "success") success("success"),
7272
@JsonProperty(value = "failure") failure("failure"),
7373
@JsonProperty(value = "unclassified") unclassified("unclassified"),
74-
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
74+
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api");
7575
}
7676
}
7777

samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Pet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ data class Pet (
5959
/**
6060
* pet status in the store
6161
*
62-
* Values: available,pending,sold,unknownDefaultOpenApi
62+
* Values: available,pending,sold,unknown_default_open_api
6363
*/
6464
enum class Status(val value: kotlin.String) {
6565
@JsonProperty(value = "available") available("available"),
6666
@JsonProperty(value = "pending") pending("pending"),
6767
@JsonProperty(value = "sold") sold("sold"),
68-
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
68+
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api");
6969
}
7070
}
7171

samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/Query.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ data class Query (
4141
/**
4242
*
4343
*
44-
* Values: sUCCESS,fAILURE,sKIPPED,unknownDefaultOpenApi
44+
* Values: SUCCESS,FAILURE,SKIPPED,unknown_default_open_api
4545
*/
4646
enum class Outcomes(val value: kotlin.String) {
47-
@JsonProperty(value = "SUCCESS") sUCCESS("SUCCESS"),
48-
@JsonProperty(value = "FAILURE") fAILURE("FAILURE"),
49-
@JsonProperty(value = "SKIPPED") sKIPPED("SKIPPED"),
50-
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
47+
@JsonProperty(value = "SUCCESS") SUCCESS("SUCCESS"),
48+
@JsonProperty(value = "FAILURE") FAILURE("FAILURE"),
49+
@JsonProperty(value = "SKIPPED") SKIPPED("SKIPPED"),
50+
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknown_default_open_api("unknown_default_open_api");
5151
}
5252
}
5353

samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
2121
/**
2222
*
2323
*
24-
* Values: success,failure,unclassified,unknownDefaultOpenApi
24+
* Values: success,failure,unclassified,unknown_default_open_api
2525
*/
2626

2727
enum class StringEnumRef(val value: kotlin.String) {
@@ -36,7 +36,7 @@ enum class StringEnumRef(val value: kotlin.String) {
3636
unclassified("unclassified"),
3737

3838
@JsonProperty(value = "unknown_default_open_api")
39-
unknownDefaultOpenApi("unknown_default_open_api");
39+
unknown_default_open_api("unknown_default_open_api");
4040

4141
/**
4242
* Override [toString()] to avoid using the enum variable name as the value, and instead use

0 commit comments

Comments
 (0)