[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 <tylerbthrailkill@gmail.com>
Co-authored-by: Jari Nystedt <jari.nystedt@tietoevry.com>
This commit is contained in:
William Cheng
2024-03-09 17:42:33 +08:00
committed by GitHub
parent 81e33ede6e
commit 494fc7d182
40 changed files with 336 additions and 117 deletions

View File

@@ -10,7 +10,7 @@
* `unclassified` (value: `"unclassified"`)
* `unknownDefaultOpenApi` (value: `"unknown_default_open_api"`)
* `unknown_default_open_api` (value: `"unknown_default_open_api"`)

View File

@@ -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");
}
}

View File

@@ -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");
}
}

View File

@@ -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");
}
}

View File

@@ -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