diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache index 57b1e5f12728..fcdcd87ffa99 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache @@ -67,12 +67,12 @@ import kotlinx.serialization.* /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is {{classname}}) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is {{classname}}) "$data" else null /** * Returns a valid [{{classname}}] for [data], null otherwise. */ - fun decode(data: Any?): {{classname}}? = data?.let { + fun decode(data: kotlin.Any?): {{classname}}? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt index aa6831225a20..4d9fa1abd645 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt @@ -50,12 +50,12 @@ enum class PetEnum(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is PetEnum) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is PetEnum) "$data" else null /** * Returns a valid [PetEnum] for [data], null otherwise. */ - fun decode(data: Any?): PetEnum? = data?.let { + fun decode(data: kotlin.Any?): PetEnum? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase()