From c599906f1ac7b4e120f6ed29ca8388f2fb738168 Mon Sep 17 00:00:00 2001 From: Benoit Vermont Date: Sun, 18 Feb 2018 15:44:35 +0100 Subject: [PATCH] Kotlin: Correct data_class.mustache to use proper property for inner enum data type (#7597) * Correct data_class.mustache to use proper property The name of the property is "datatype" lowercase, as can be seen in https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java#L10 Using "dataType" does not work, and the type of the inner enum is null. * Change in petstore --- .../src/main/resources/kotlin-client/data_class.mustache | 2 +- .../kotlin/src/main/kotlin/io/swagger/client/models/Order.kt | 2 +- .../kotlin/src/main/kotlin/io/swagger/client/models/Pet.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/kotlin-client/data_class.mustache b/modules/swagger-codegen/src/main/resources/kotlin-client/data_class.mustache index 1237ec1f4311..e64785e01b15 100644 --- a/modules/swagger-codegen/src/main/resources/kotlin-client/data_class.mustache +++ b/modules/swagger-codegen/src/main/resources/kotlin-client/data_class.mustache @@ -16,7 +16,7 @@ data class {{classname}} ( * {{{description}}} * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ - enum class {{nameInCamelCase}}(val value: {{dataType}}){ + enum class {{nameInCamelCase}}(val value: {{datatype}}){ {{#allowableValues}}{{#enumVars}} {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} {{/enumVars}}{{/allowableValues}} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Order.kt index 6f96c317e953..78afb772e9a2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Order.kt @@ -35,7 +35,7 @@ data class Order ( * Order Status * Values: placed,approved,delivered */ - enum class Status(val value: kotlin.Any){ + enum class Status(val value: kotlin.String){ placed("placed"), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Pet.kt index c507522da923..8c0256b3be8e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/io/swagger/client/models/Pet.kt @@ -37,7 +37,7 @@ data class Pet ( * pet status in the store * Values: available,pending,sold */ - enum class Status(val value: kotlin.Any){ + enum class Status(val value: kotlin.String){ available("available"),