From 80484d599c7f6f95f6ff67f0fc8ebcead80af976 Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Thu, 22 Aug 2019 13:40:03 -0400 Subject: [PATCH 1/8] Support gson in Kotlin client generated code. Summary of changes: - Added a new 'serializationEngine' option for config.json with 2 valid values: "moshi" (default) and "gson" - updated to kotlin-client mustache templates to support gson's @SerializedName annotation - this also helps with proguard which can break JSON binding to object in release code - removed empty {} in the data class body when there is no enums - this fixes annoying visual indicators of empty body in Android Studio IDE when looking at data classes without enums. Testing: # Test 1 mvn clean install ./bin/kotlin-client-petstore.sh cd samples/client/petstore/kotlin gradle wrapper; ./gradlew check assemble test success # Test 2 ./bin/kotlin-client-petstore.sh --additional-properties serializationEngine=gson cd samples/client/petstore/kotlin gradle wrapper; ./gradlew check assemble test success # Test 3 ./bin/kotlin-client-petstore.sh --additional-properties serializationEngine=foobar verified proper error message is displayed: Exception in thread "main" java.lang.RuntimeException: foobar is an invalid enum property naming option. Please choose from: moshi gson at org.openapitools.codegen.languages.AbstractKotlinCodegen.setSerializationEngine(AbstractKotlinCodegen.java:286) at org.openapitools.codegen.languages.AbstractKotlinCodegen.processOpts(AbstractKotlinCodegen.java:360) at org.openapitools.codegen.languages.KotlinClientCodegen.processOpts(KotlinClientCodegen.java:122) at org.openapitools.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:194) at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:910) at org.openapitools.codegen.cmd.Generate.run(Generate.java:400) at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60) --- .../codegen/CodegenConstants.java | 4 +++ .../languages/AbstractKotlinCodegen.java | 31 +++++++++++++++++++ .../kotlin-client/build.gradle.mustache | 3 ++ .../kotlin-client/data_class.mustache | 18 ++++++++--- .../kotlin-client/data_class_opt_var.mustache | 3 +- .../kotlin-client/data_class_req_var.mustache | 3 +- .../kotlin-client/enum_class.mustache | 10 ++++++ 7 files changed, 66 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 0cf95af984df..624813b76bdb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -202,6 +202,10 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, public static final String ENUM_PROPERTY_NAMING = "enumPropertyNaming"; public static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'"; + public static final String SERIALIZATION_ENGINE = "serializationEngine"; + public static final String SERIALIZATION_ENGINE_DESC = "What serialization engine to use: 'moshi' (default), or 'gson'"; + public static enum SERIALIZATION_ENGINE_TYPE {moshi, gson} + public static final String MODEL_NAME_PREFIX = "modelNamePrefix"; public static final String MODEL_NAME_PREFIX_DESC = "Prefix that will be prepended to all model names."; 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 148cbb547aeb..36063460f1dc 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 @@ -51,6 +51,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co protected boolean parcelizeModels = false; protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase; + protected CodegenConstants.SERIALIZATION_ENGINE_TYPE serializationEngine = CodegenConstants.SERIALIZATION_ENGINE_TYPE.moshi; public AbstractKotlinCodegen() { super(); @@ -205,6 +206,10 @@ public AbstractKotlinCodegen() { CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC); cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name())); + + CliOption serializationEngineOpt = new CliOption(CodegenConstants.SERIALIZATION_ENGINE, CodegenConstants.SERIALIZATION_ENGINE_DESC); + cliOptions.add(serializationEngineOpt.defaultValue(serializationEngine.name())); + cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC)); } @@ -244,6 +249,10 @@ public CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming() { return this.enumPropertyNaming; } + public CodegenConstants.SERIALIZATION_ENGINE_TYPE getSerializationEngine() { + return this.serializationEngine; + } + /** * Sets the naming convention for Kotlin enum properties * @@ -261,6 +270,23 @@ public void setEnumPropertyNaming(final String enumPropertyNamingType) { } } + /** + * Sets the serialization engine for Kotlin + * + * @param enumSerializationEngine The string representation of the serialization engine as defined by {@link CodegenConstants.SERIALIZATION_ENGINE_TYPE} + */ + public void setSerializationEngine(final String enumSerializationEngine) { + try { + this.serializationEngine = CodegenConstants.SERIALIZATION_ENGINE_TYPE.valueOf(enumSerializationEngine); + } catch (IllegalArgumentException ex) { + StringBuilder sb = new StringBuilder(enumSerializationEngine + " is an invalid enum property naming option. Please choose from:"); + for (CodegenConstants.SERIALIZATION_ENGINE_TYPE t : CodegenConstants.SERIALIZATION_ENGINE_TYPE.values()) { + sb.append("\n ").append(t.name()); + } + throw new RuntimeException(sb.toString()); + } + } + /** * returns the swagger type for the property * @@ -330,6 +356,11 @@ public void processOpts() { setEnumPropertyNaming((String) additionalProperties.get(CodegenConstants.ENUM_PROPERTY_NAMING)); } + if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_ENGINE)) { + setSerializationEngine((String) additionalProperties.get(CodegenConstants.SERIALIZATION_ENGINE)); + additionalProperties.put(this.serializationEngine.name(), true); + } + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); } else { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache index 05954bb78a60..e735dc05a205 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache @@ -32,6 +32,9 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "com.squareup.moshi:moshi-kotlin:1.8.0" compile "com.squareup.moshi:moshi-adapters:1.8.0" + {{#gson}} + implementation "com.google.code.gson:gson:2.8.5" + {{/gson}} compile "com.squareup.okhttp3:okhttp:4.0.1" {{#threetenbp}} compile "org.threeten:threetenbp:1.3.8" diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache index 35b32bc12aab..a9f020ff4003 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache @@ -1,4 +1,9 @@ +{{#gson}} +import com.google.gson.annotations.SerializedName +{{/gson}} +{{#moshi}} import com.squareup.moshi.Json +{{/moshi}} {{#parcelizeModels}} import android.os.Parcelable import kotlinx.android.parcel.Parcelize @@ -19,17 +24,22 @@ data class {{classname}} ( {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>data_class_opt_var}}{{^-last}}, {{/-last}}{{/optionalVars}} -){{#parcelizeModels}} : Parcelable{{/parcelizeModels}} { +){{#parcelizeModels}} : Parcelable{{/parcelizeModels}} {{#hasEnums}}{{#vars}}{{#isEnum}} +{ /** * {{{description}}} * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ {{#allowableValues}}{{#enumVars}} - @Json(name = {{{value}}}) - {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{#moshi}} + @Json(name = {{{value}}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/moshi}} + {{#gson}} + @SerializedName(value={{{value}}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/gson}} {{/enumVars}}{{/allowableValues}} } -{{/isEnum}}{{/vars}}{{/hasEnums}} } +{{/isEnum}}{{/vars}}{{/hasEnums}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache index 03cbd718c34a..c444a8590cb3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache @@ -1,5 +1,6 @@ {{#description}} /* {{{description}}} */ {{/description}} - @Json(name = "{{{baseName}}}") + {{#moshi}}@Json(name = "{{{baseName}}}"){{/moshi}} + {{#gson}}@SerializedName("{{name}}"){{/gson}} val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache index 6682bc8170c7..8223c9391c1c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache @@ -1,5 +1,6 @@ {{#description}} /* {{{description}}} */ {{/description}} - @Json(name = "{{{baseName}}}") + {{#moshi}}@Json(name = "{{{baseName}}}"){{/moshi}} + {{#gson}}@SerializedName("{{name}}"){{/gson}} val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file 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 80b040f6b7c0..af9a327b3dbf 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 @@ -1,4 +1,9 @@ +{{#gson}} +import com.google.gson.annotations.SerializedName +{{/gson}} +{{#moshi}} import com.squareup.moshi.Json +{{/moshi}} /** * {{{description}}} @@ -7,7 +12,12 @@ import com.squareup.moshi.Json enum class {{classname}}(val value: {{{dataType}}}){ {{#allowableValues}}{{#enumVars}} + {{#moshi}} @Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) + {{/moshi}} + {{#gson}} + @SerializedName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) + {{/gson}} {{#isListContainer}} {{#isList}} {{&name}}(listOf({{{value}}})){{^-last}},{{/-last}}{{#-last}};{{/-last}} From f9e823ddee8bc25095f6b8fb913b95b4acd9bab8 Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Thu, 22 Aug 2019 14:00:58 -0400 Subject: [PATCH 2/8] Fixed script so it can take additional command line arguments. --- bin/openapi3/kotlin-client-petstore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/openapi3/kotlin-client-petstore.sh b/bin/openapi3/kotlin-client-petstore.sh index 5ffd829b05d4..f426dba223b8 100755 --- a/bin/openapi3/kotlin-client-petstore.sh +++ b/bin/openapi3/kotlin-client-petstore.sh @@ -26,7 +26,7 @@ then fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@" echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin" rm -rf samples/openapi3/client/petstore/kotlin From ae98e7b32e74e6f9ad701b52d150ee58b689c34a Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Sun, 25 Aug 2019 17:37:19 -0400 Subject: [PATCH 3/8] re-generated petstore and petstore openapi3 sample client for kotlin --- .../languages/AbstractKotlinCodegen.java | 3 ++ .../openapitools/client/models/ApiResponse.kt | 6 ++- .../openapitools/client/models/Category.kt | 5 +- .../org/openapitools/client/models/Order.kt | 20 +++++--- .../org/openapitools/client/models/Pet.kt | 20 +++++--- .../org/openapitools/client/models/Tag.kt | 5 +- .../org/openapitools/client/models/User.kt | 11 ++++- .../models/AdditionalPropertiesClass.kt | 5 +- .../org/openapitools/client/models/Animal.kt | 5 +- .../openapitools/client/models/ApiResponse.kt | 6 ++- .../client/models/ArrayOfArrayOfNumberOnly.kt | 4 +- .../client/models/ArrayOfNumberOnly.kt | 4 +- .../openapitools/client/models/ArrayTest.kt | 6 ++- .../client/models/Capitalization.kt | 9 +++- .../org/openapitools/client/models/Cat.kt | 6 ++- .../openapitools/client/models/CatAllOf.kt | 4 +- .../openapitools/client/models/Category.kt | 5 +- .../openapitools/client/models/ClassModel.kt | 4 +- .../org/openapitools/client/models/Client.kt | 4 +- .../org/openapitools/client/models/Dog.kt | 6 ++- .../openapitools/client/models/DogAllOf.kt | 4 +- .../openapitools/client/models/EnumArrays.kt | 21 ++++---- .../openapitools/client/models/EnumTest.kt | 49 ++++++++++--------- .../client/models/FileSchemaTestClass.kt | 5 +- .../org/openapitools/client/models/Foo.kt | 4 +- .../openapitools/client/models/FormatTest.kt | 18 ++++++- .../client/models/HasOnlyReadOnly.kt | 5 +- .../client/models/HealthCheckResult.kt | 4 +- .../client/models/InlineObject.kt | 5 +- .../client/models/InlineObject1.kt | 5 +- .../client/models/InlineObject2.kt | 24 ++++----- .../client/models/InlineObject3.kt | 17 ++++++- .../client/models/InlineObject4.kt | 5 +- .../client/models/InlineObject5.kt | 5 +- .../client/models/InlineResponseDefault.kt | 4 +- .../org/openapitools/client/models/List.kt | 4 +- .../org/openapitools/client/models/MapTest.kt | 15 +++--- ...dPropertiesAndAdditionalPropertiesClass.kt | 6 ++- .../client/models/Model200Response.kt | 5 +- .../org/openapitools/client/models/Name.kt | 7 ++- .../client/models/NullableClass.kt | 15 +++++- .../openapitools/client/models/NumberOnly.kt | 4 +- .../org/openapitools/client/models/Order.kt | 20 +++++--- .../client/models/OuterComposite.kt | 6 ++- .../org/openapitools/client/models/Pet.kt | 20 +++++--- .../client/models/ReadOnlyFirst.kt | 5 +- .../org/openapitools/client/models/Return.kt | 4 +- .../client/models/SpecialModelname.kt | 4 +- .../org/openapitools/client/models/Tag.kt | 5 +- .../org/openapitools/client/models/User.kt | 11 ++++- 50 files changed, 280 insertions(+), 164 deletions(-) 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 36063460f1dc..7206b1c2fe48 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 @@ -360,6 +360,9 @@ public void processOpts() { setSerializationEngine((String) additionalProperties.get(CodegenConstants.SERIALIZATION_ENGINE)); additionalProperties.put(this.serializationEngine.name(), true); } + else { + additionalProperties.put(this.serializationEngine.name(), true); + } if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 47109faf6125..97fb9678c869 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,12 +21,14 @@ import com.squareup.moshi.Json */ data class ApiResponse ( @Json(name = "code") + val code: kotlin.Int? = null, @Json(name = "type") + val type: kotlin.String? = null, @Json(name = "message") + val message: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index f068a02b1a03..5f84a3f886e8 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class Category ( @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "name") + val name: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index 00e62b88092c..3a4d44310a17 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,36 +24,40 @@ import com.squareup.moshi.Json */ 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.LocalDateTime? = null, /* Order Status */ @Json(name = "status") + val status: Order.Status? = null, @Json(name = "complete") + val complete: kotlin.Boolean? = null -) { +) +{ /** * Order Status * Values: placed,approved,delivered */ enum class Status(val value: kotlin.String){ - @Json(name = "placed") - placed("placed"), + @Json(name = "placed") placed("placed"), - @Json(name = "approved") - approved("approved"), + @Json(name = "approved") approved("approved"), - @Json(name = "delivered") - delivered("delivered"); + @Json(name = "delivered") delivered("delivered"); } - } + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index 88a536ea6227..929a8a5133bb 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,36 +26,40 @@ import com.squareup.moshi.Json */ data class Pet ( @Json(name = "name") + val name: kotlin.String, @Json(name = "photoUrls") + val photoUrls: kotlin.Array, @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "category") + val category: Category? = null, @Json(name = "tags") + val tags: kotlin.Array? = null, /* pet status in the store */ @Json(name = "status") + val status: Pet.Status? = null -) { +) +{ /** * pet status in the store * Values: available,pending,sold */ enum class Status(val value: kotlin.String){ - @Json(name = "available") - available("available"), + @Json(name = "available") available("available"), - @Json(name = "pending") - pending("pending"), + @Json(name = "pending") pending("pending"), - @Json(name = "sold") - sold("sold"); + @Json(name = "sold") sold("sold"); } - } + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index e67b899b1ff8..b27f59b4f668 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class Tag ( @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "name") + val name: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index 6a66d8e523b9..df433469cc23 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,23 +26,30 @@ import com.squareup.moshi.Json */ data class User ( @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "username") + val username: kotlin.String? = null, @Json(name = "firstName") + val firstName: kotlin.String? = null, @Json(name = "lastName") + val lastName: kotlin.String? = null, @Json(name = "email") + val email: kotlin.String? = null, @Json(name = "password") + val password: kotlin.String? = null, @Json(name = "phone") + val phone: kotlin.String? = null, /* User Status */ @Json(name = "userStatus") + val userStatus: kotlin.Int? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt index ad9d5f84c576..8a9ac8e5e796 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class AdditionalPropertiesClass ( @Json(name = "map_property") + val mapProperty: kotlin.collections.Map? = null, @Json(name = "map_of_map_property") + val mapOfMapProperty: kotlin.collections.Map>? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt index 655306a7e897..d8d7435a62d8 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class Animal ( @Json(name = "className") + val className: kotlin.String, @Json(name = "color") + val color: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f79e529c2fc1..953908f87e2f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,12 +21,14 @@ import com.squareup.moshi.Json */ data class ApiResponse ( @Json(name = "code") + val code: kotlin.Int? = null, @Json(name = "type") + val type: kotlin.String? = null, @Json(name = "message") + val message: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt index 3be01f40411f..54c0e4f06e91 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class ArrayOfArrayOfNumberOnly ( @Json(name = "ArrayArrayNumber") + val arrayArrayNumber: kotlin.Array>? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt index d4d24cd34edb..e2202ff96b20 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class ArrayOfNumberOnly ( @Json(name = "ArrayNumber") + val arrayNumber: kotlin.Array? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt index 51fd93eec0e9..314bdd19252f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt @@ -22,12 +22,14 @@ import com.squareup.moshi.Json */ data class ArrayTest ( @Json(name = "array_of_string") + val arrayOfString: kotlin.Array? = null, @Json(name = "array_array_of_integer") + val arrayArrayOfInteger: kotlin.Array>? = null, @Json(name = "array_array_of_model") + val arrayArrayOfModel: kotlin.Array>? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt index ec12c128324d..5ecc603f152d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt @@ -24,19 +24,24 @@ import com.squareup.moshi.Json */ data class Capitalization ( @Json(name = "smallCamel") + val smallCamel: kotlin.String? = null, @Json(name = "CapitalCamel") + val capitalCamel: kotlin.String? = null, @Json(name = "small_Snake") + val smallSnake: kotlin.String? = null, @Json(name = "Capital_Snake") + val capitalSnake: kotlin.String? = null, @Json(name = "SCA_ETH_Flow_Points") + val scAETHFlowPoints: kotlin.String? = null, /* Name of the pet */ @Json(name = "ATT_NAME") + val ATT_NAME: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt index f7fc445d9efe..f493dc2735de 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt @@ -21,12 +21,14 @@ import com.squareup.moshi.Json */ data class Cat ( @Json(name = "className") + val className: kotlin.String, @Json(name = "declawed") + val declawed: kotlin.Boolean? = null, @Json(name = "color") + val color: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt index c20830cfc990..e2e155c8f6d4 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class CatAllOf ( @Json(name = "declawed") + val declawed: kotlin.Boolean? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index 637d8f39fdb9..016b7b48b8c3 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class Category ( @Json(name = "name") + val name: kotlin.String, @Json(name = "id") + val id: kotlin.Long? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt index 92425fba5640..6567266b71ed 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class ClassModel ( @Json(name = "_class") + val propertyClass: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt index 656eff708d20..f7e72ce333e9 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class Client ( @Json(name = "client") + val client: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt index 6f194f25a802..3b8af4c15cbc 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt @@ -21,12 +21,14 @@ import com.squareup.moshi.Json */ data class Dog ( @Json(name = "className") + val className: kotlin.String, @Json(name = "breed") + val breed: kotlin.String? = null, @Json(name = "color") + val color: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt index fab37948f8cc..51d35e978cab 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class DogAllOf ( @Json(name = "breed") + val breed: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt index 1908c031f154..75ecfa8c887c 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt @@ -20,38 +20,39 @@ import com.squareup.moshi.Json */ data class EnumArrays ( @Json(name = "just_symbol") + val justSymbol: EnumArrays.JustSymbol? = null, @Json(name = "array_enum") + val arrayEnum: kotlin.Array? = null -) { +) +{ /** * * Values: greaterThanEqual,dollar */ enum class JustSymbol(val value: kotlin.String){ - @Json(name = ">=") - greaterThanEqual(">="), + @Json(name = ">=") greaterThanEqual(">="), - @Json(name = "$") - dollar("$"); + @Json(name = "$") dollar("$"); } +} +{ /** * * Values: fish,crab */ enum class ArrayEnum(val value: kotlin.String){ - @Json(name = "fish") - fish("fish"), + @Json(name = "fish") fish("fish"), - @Json(name = "crab") - crab("crab"); + @Json(name = "crab") crab("crab"); } - } + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt index 59cd40f659e4..3c54820bd163 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt @@ -30,84 +30,89 @@ import com.squareup.moshi.Json */ data class EnumTest ( @Json(name = "enum_string_required") + val enumStringRequired: EnumTest.EnumStringRequired, @Json(name = "enum_string") + val enumString: EnumTest.EnumString? = null, @Json(name = "enum_integer") + val enumInteger: EnumTest.EnumInteger? = null, @Json(name = "enum_number") + val enumNumber: EnumTest.EnumNumber? = null, @Json(name = "outerEnum") + val outerEnum: OuterEnum? = null, @Json(name = "outerEnumInteger") + val outerEnumInteger: OuterEnumInteger? = null, @Json(name = "outerEnumDefaultValue") + val outerEnumDefaultValue: OuterEnumDefaultValue? = null, @Json(name = "outerEnumIntegerDefaultValue") + val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = null -) { +) +{ /** * * Values: uPPER,lower,eMPTY */ enum class EnumString(val value: kotlin.String){ - @Json(name = "UPPER") - uPPER("UPPER"), + @Json(name = "UPPER") uPPER("UPPER"), - @Json(name = "lower") - lower("lower"), + @Json(name = "lower") lower("lower"), - @Json(name = "") - eMPTY(""); + @Json(name = "") eMPTY(""); } +} +{ /** * * Values: uPPER,lower,eMPTY */ enum class EnumStringRequired(val value: kotlin.String){ - @Json(name = "UPPER") - uPPER("UPPER"), + @Json(name = "UPPER") uPPER("UPPER"), - @Json(name = "lower") - lower("lower"), + @Json(name = "lower") lower("lower"), - @Json(name = "") - eMPTY(""); + @Json(name = "") eMPTY(""); } +} +{ /** * * Values: _1,minus1 */ enum class EnumInteger(val value: kotlin.Int){ - @Json(name = 1) - _1(1), + @Json(name = 1) _1(1), - @Json(name = -1) - minus1(-1); + @Json(name = -1) minus1(-1); } +} +{ /** * * Values: _1period1,minus1Period2 */ enum class EnumNumber(val value: kotlin.Double){ - @Json(name = 1.1) - _1period1(1.1), + @Json(name = 1.1) _1period1(1.1), - @Json(name = -1.2) - minus1Period2(-1.2); + @Json(name = -1.2) minus1Period2(-1.2); } - } + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt index 003bc5c6b692..9d9a93a9d4c5 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class FileSchemaTestClass ( @Json(name = "file") + val file: java.io.File? = null, @Json(name = "files") + val files: kotlin.Array? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt index 40d0f465db31..7abdc119c34e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class Foo ( @Json(name = "bar") + val bar: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index 79c8dc6968e8..b2f3f5b1d057 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -33,38 +33,52 @@ import com.squareup.moshi.Json */ data class FormatTest ( @Json(name = "number") + val number: java.math.BigDecimal, @Json(name = "byte") + val byte: kotlin.ByteArray, @Json(name = "date") + val date: java.time.LocalDate, @Json(name = "password") + val password: kotlin.String, @Json(name = "integer") + val integer: kotlin.Int? = null, @Json(name = "int32") + val int32: kotlin.Int? = null, @Json(name = "int64") + val int64: kotlin.Long? = null, @Json(name = "float") + val float: kotlin.Float? = null, @Json(name = "double") + val double: kotlin.Double? = null, @Json(name = "string") + val string: kotlin.String? = null, @Json(name = "binary") + val binary: java.io.File? = null, @Json(name = "dateTime") + val dateTime: java.time.LocalDateTime? = null, @Json(name = "uuid") + val uuid: java.util.UUID? = null, /* A string that is a 10 digit number. Can have leading zeros. */ @Json(name = "pattern_with_digits") + val patternWithDigits: kotlin.String? = null, /* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */ @Json(name = "pattern_with_digits_and_delimiter") + val patternWithDigitsAndDelimiter: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt index 2fae92679874..6d72adf6501f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class HasOnlyReadOnly ( @Json(name = "bar") + val bar: kotlin.String? = null, @Json(name = "foo") + val foo: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt index f0466b799b49..22b2b7cc839c 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class HealthCheckResult ( @Json(name = "NullableMessage") + val nullableMessage: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt index 53a7082ac0ac..b7eb1777463e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt @@ -21,11 +21,12 @@ import com.squareup.moshi.Json data class InlineObject ( /* Updated name of the pet */ @Json(name = "name") + val name: kotlin.String? = null, /* Updated status of the pet */ @Json(name = "status") + val status: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt index 0917219b4ef5..61da4d727d6b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt @@ -21,11 +21,12 @@ import com.squareup.moshi.Json data class InlineObject1 ( /* Additional data to pass to server */ @Json(name = "additionalMetadata") + val additionalMetadata: kotlin.String? = null, /* file to upload */ @Json(name = "file") + val file: java.io.File? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt index bf824926150e..b5fc7378f4cf 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt @@ -21,42 +21,42 @@ import com.squareup.moshi.Json data class InlineObject2 ( /* Form parameter enum test (string array) */ @Json(name = "enum_form_string_array") + val enumFormStringArray: kotlin.Array? = null, /* Form parameter enum test (string) */ @Json(name = "enum_form_string") + val enumFormString: InlineObject2.EnumFormString? = null -) { +) +{ /** * Form parameter enum test (string array) * Values: greaterThan,dollar */ enum class EnumFormStringArray(val value: kotlin.String){ - @Json(name = ">") - greaterThan(">"), + @Json(name = ">") greaterThan(">"), - @Json(name = "$") - dollar("$"); + @Json(name = "$") dollar("$"); } +} +{ /** * Form parameter enum test (string) * Values: abc,minusEfg,leftParenthesisXyzRightParenthesis */ enum class EnumFormString(val value: kotlin.String){ - @Json(name = "_abc") - abc("_abc"), + @Json(name = "_abc") abc("_abc"), - @Json(name = "-efg") - minusEfg("-efg"), + @Json(name = "-efg") minusEfg("-efg"), - @Json(name = "(xyz)") - leftParenthesisXyzRightParenthesis("(xyz)"); + @Json(name = "(xyz)") leftParenthesisXyzRightParenthesis("(xyz)"); } - } + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt index 4ade49136757..be6efba09577 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt @@ -33,47 +33,60 @@ import com.squareup.moshi.Json data class InlineObject3 ( /* None */ @Json(name = "number") + val number: java.math.BigDecimal, /* None */ @Json(name = "double") + val double: kotlin.Double, /* None */ @Json(name = "pattern_without_delimiter") + val patternWithoutDelimiter: kotlin.String, /* None */ @Json(name = "byte") + val byte: kotlin.ByteArray, /* None */ @Json(name = "integer") + val integer: kotlin.Int? = null, /* None */ @Json(name = "int32") + val int32: kotlin.Int? = null, /* None */ @Json(name = "int64") + val int64: kotlin.Long? = null, /* None */ @Json(name = "float") + val float: kotlin.Float? = null, /* None */ @Json(name = "string") + val string: kotlin.String? = null, /* None */ @Json(name = "binary") + val binary: java.io.File? = null, /* None */ @Json(name = "date") + val date: java.time.LocalDate? = null, /* None */ @Json(name = "dateTime") + val dateTime: java.time.LocalDateTime? = null, /* None */ @Json(name = "password") + val password: kotlin.String? = null, /* None */ @Json(name = "callback") + val callback: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt index 91b9c2a9cdf2..e571e052b106 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt @@ -21,11 +21,12 @@ import com.squareup.moshi.Json data class InlineObject4 ( /* field1 */ @Json(name = "param") + val param: kotlin.String, /* field2 */ @Json(name = "param2") + val param2: kotlin.String -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt index f058f58c4441..8f87948e875b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt @@ -21,11 +21,12 @@ import com.squareup.moshi.Json data class InlineObject5 ( /* file to upload */ @Json(name = "requiredFile") + val requiredFile: java.io.File, /* Additional data to pass to server */ @Json(name = "additionalMetadata") + val additionalMetadata: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt index ea862cef739c..9eab8b4be387 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt @@ -20,8 +20,8 @@ import com.squareup.moshi.Json */ data class InlineResponseDefault ( @Json(name = "string") + val string: Foo? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt index 533fb21cc80b..1820df36ba42 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class List ( @Json(name = "123-list") + val `123minusList`: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt index 8d752fbb6887..ce69f2cb4d41 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt @@ -22,28 +22,31 @@ import com.squareup.moshi.Json */ data class MapTest ( @Json(name = "map_map_of_string") + val mapMapOfString: kotlin.collections.Map>? = null, @Json(name = "map_of_enum_string") + val mapOfEnumString: MapTest.MapOfEnumString? = null, @Json(name = "direct_map") + val directMap: kotlin.collections.Map? = null, @Json(name = "indirect_map") + val indirectMap: kotlin.collections.Map? = null -) { +) +{ /** * * Values: uPPER,lower */ enum class MapOfEnumString(val value: kotlin.collections.Map){ - @Json(name = "UPPER") - uPPER("UPPER"), + @Json(name = "UPPER") uPPER("UPPER"), - @Json(name = "lower") - lower("lower"); + @Json(name = "lower") lower("lower"); } - } + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt index 63bf58d8b93c..5a2ad3cc609d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt @@ -22,12 +22,14 @@ import com.squareup.moshi.Json */ data class MixedPropertiesAndAdditionalPropertiesClass ( @Json(name = "uuid") + val uuid: java.util.UUID? = null, @Json(name = "dateTime") + val dateTime: java.time.LocalDateTime? = null, @Json(name = "map") + val map: kotlin.collections.Map? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt index 42c48fa7fd1c..923711beb6e5 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class Model200Response ( @Json(name = "name") + val name: kotlin.Int? = null, @Json(name = "class") + val propertyClass: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt index d46b4b1c5112..6cc4dde15d51 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt @@ -22,14 +22,17 @@ import com.squareup.moshi.Json */ data class Name ( @Json(name = "name") + val name: kotlin.Int, @Json(name = "snake_case") + val snakeCase: kotlin.Int? = null, @Json(name = "property") + val property: kotlin.String? = null, @Json(name = "123Number") + val `123number`: kotlin.Int? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt index 4b75b41a9d75..b61b88b8e6d6 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt @@ -30,30 +30,41 @@ import com.squareup.moshi.Json */ data class NullableClass ( @Json(name = "integer_prop") + val integerProp: kotlin.Int? = null, @Json(name = "number_prop") + val numberProp: java.math.BigDecimal? = null, @Json(name = "boolean_prop") + val booleanProp: kotlin.Boolean? = null, @Json(name = "string_prop") + val stringProp: kotlin.String? = null, @Json(name = "date_prop") + val dateProp: java.time.LocalDate? = null, @Json(name = "datetime_prop") + val datetimeProp: java.time.LocalDateTime? = null, @Json(name = "array_nullable_prop") + val arrayNullableProp: kotlin.Array? = null, @Json(name = "array_and_items_nullable_prop") + val arrayAndItemsNullableProp: kotlin.Array? = null, @Json(name = "array_items_nullable") + val arrayItemsNullable: kotlin.Array? = null, @Json(name = "object_nullable_prop") + val objectNullableProp: kotlin.collections.Map? = null, @Json(name = "object_and_items_nullable_prop") + val objectAndItemsNullableProp: kotlin.collections.Map? = null, @Json(name = "object_items_nullable") + val objectItemsNullable: kotlin.collections.Map? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt index c8126af08483..6eda326e0056 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class NumberOnly ( @Json(name = "JustNumber") + val justNumber: java.math.BigDecimal? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index 296d77047cc5..6b82b62382ad 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,36 +24,40 @@ import com.squareup.moshi.Json */ 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.LocalDateTime? = null, /* Order Status */ @Json(name = "status") + val status: Order.Status? = null, @Json(name = "complete") + val complete: kotlin.Boolean? = null -) { +) +{ /** * Order Status * Values: placed,approved,delivered */ enum class Status(val value: kotlin.String){ - @Json(name = "placed") - placed("placed"), + @Json(name = "placed") placed("placed"), - @Json(name = "approved") - approved("approved"), + @Json(name = "approved") approved("approved"), - @Json(name = "delivered") - delivered("delivered"); + @Json(name = "delivered") delivered("delivered"); } - } + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt index a0bc846a09b9..c0ce5c1d9a9e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt @@ -21,12 +21,14 @@ import com.squareup.moshi.Json */ data class OuterComposite ( @Json(name = "my_number") + val myNumber: java.math.BigDecimal? = null, @Json(name = "my_string") + val myString: kotlin.String? = null, @Json(name = "my_boolean") + val myBoolean: kotlin.Boolean? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index 5adf5a0e5f3a..f59712f5933d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,36 +26,40 @@ import com.squareup.moshi.Json */ data class Pet ( @Json(name = "name") + val name: kotlin.String, @Json(name = "photoUrls") + val photoUrls: kotlin.Array, @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "category") + val category: Category? = null, @Json(name = "tags") + val tags: kotlin.Array? = null, /* pet status in the store */ @Json(name = "status") + val status: Pet.Status? = null -) { +) +{ /** * pet status in the store * Values: available,pending,sold */ enum class Status(val value: kotlin.String){ - @Json(name = "available") - available("available"), + @Json(name = "available") available("available"), - @Json(name = "pending") - pending("pending"), + @Json(name = "pending") pending("pending"), - @Json(name = "sold") - sold("sold"); + @Json(name = "sold") sold("sold"); } - } + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt index b47c5617c837..3a87426b4912 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class ReadOnlyFirst ( @Json(name = "bar") + val bar: kotlin.String? = null, @Json(name = "baz") + val baz: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt index 59a24cd83518..4e7d8201056a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class Return ( @Json(name = "return") + val `return`: kotlin.Int? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index 2768460ff671..4e6a8f606b39 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -19,8 +19,8 @@ import com.squareup.moshi.Json */ data class SpecialModelname ( @Json(name = "$special[property.name]") + val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index bb7bf2ec0730..b26df9ef63f7 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,10 +20,11 @@ import com.squareup.moshi.Json */ data class Tag ( @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "name") + val name: kotlin.String? = null -) { +) -} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index d0384bc2069d..320c519144db 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,23 +26,30 @@ import com.squareup.moshi.Json */ data class User ( @Json(name = "id") + val id: kotlin.Long? = null, @Json(name = "username") + val username: kotlin.String? = null, @Json(name = "firstName") + val firstName: kotlin.String? = null, @Json(name = "lastName") + val lastName: kotlin.String? = null, @Json(name = "email") + val email: kotlin.String? = null, @Json(name = "password") + val password: kotlin.String? = null, @Json(name = "phone") + val phone: kotlin.String? = null, /* User Status */ @Json(name = "userStatus") + val userStatus: kotlin.Int? = null -) { +) -} From 38a8dc2af8f6d689ee44b0a725eb691f20f3c93a Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Mon, 26 Aug 2019 10:07:55 -0400 Subject: [PATCH 4/8] As suggested in https://github.com/OpenAPITools/openapi-generator/pull/3759#issuecomment-524813781, I renamed serializationEngine to serializationLibrary Fixed the data class mustache template to not add an extra line between the @entity and the variable name Regenerated petstore samples --- .../codegen/CodegenConstants.java | 6 ++-- .../languages/AbstractKotlinCodegen.java | 28 +++++++++---------- .../kotlin-client/data_class_opt_var.mustache | 8 ++++-- .../kotlin-client/data_class_req_var.mustache | 8 ++++-- .../openapitools/client/models/ApiResponse.kt | 3 -- .../openapitools/client/models/Category.kt | 2 -- .../org/openapitools/client/models/Order.kt | 6 ---- .../org/openapitools/client/models/Pet.kt | 6 ---- .../org/openapitools/client/models/Tag.kt | 2 -- .../org/openapitools/client/models/User.kt | 8 ------ .../models/AdditionalPropertiesClass.kt | 2 -- .../org/openapitools/client/models/Animal.kt | 2 -- .../openapitools/client/models/ApiResponse.kt | 3 -- .../client/models/ArrayOfArrayOfNumberOnly.kt | 1 - .../client/models/ArrayOfNumberOnly.kt | 1 - .../openapitools/client/models/ArrayTest.kt | 3 -- .../client/models/Capitalization.kt | 6 ---- .../org/openapitools/client/models/Cat.kt | 3 -- .../openapitools/client/models/CatAllOf.kt | 1 - .../openapitools/client/models/Category.kt | 2 -- .../openapitools/client/models/ClassModel.kt | 1 - .../org/openapitools/client/models/Client.kt | 1 - .../org/openapitools/client/models/Dog.kt | 3 -- .../openapitools/client/models/DogAllOf.kt | 1 - .../openapitools/client/models/EnumArrays.kt | 2 -- .../openapitools/client/models/EnumTest.kt | 8 ------ .../client/models/FileSchemaTestClass.kt | 2 -- .../org/openapitools/client/models/Foo.kt | 1 - .../openapitools/client/models/FormatTest.kt | 15 ---------- .../client/models/HasOnlyReadOnly.kt | 2 -- .../client/models/HealthCheckResult.kt | 1 - .../client/models/InlineObject.kt | 2 -- .../client/models/InlineObject1.kt | 2 -- .../client/models/InlineObject2.kt | 2 -- .../client/models/InlineObject3.kt | 14 ---------- .../client/models/InlineObject4.kt | 2 -- .../client/models/InlineObject5.kt | 2 -- .../client/models/InlineResponseDefault.kt | 1 - .../org/openapitools/client/models/List.kt | 1 - .../org/openapitools/client/models/MapTest.kt | 4 --- ...dPropertiesAndAdditionalPropertiesClass.kt | 3 -- .../client/models/Model200Response.kt | 2 -- .../org/openapitools/client/models/Name.kt | 4 --- .../client/models/NullableClass.kt | 12 -------- .../openapitools/client/models/NumberOnly.kt | 1 - .../org/openapitools/client/models/Order.kt | 6 ---- .../client/models/OuterComposite.kt | 3 -- .../org/openapitools/client/models/Pet.kt | 6 ---- .../client/models/ReadOnlyFirst.kt | 2 -- .../org/openapitools/client/models/Return.kt | 1 - .../client/models/SpecialModelname.kt | 1 - .../org/openapitools/client/models/Tag.kt | 2 -- .../org/openapitools/client/models/User.kt | 8 ------ 53 files changed, 29 insertions(+), 190 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 624813b76bdb..db77041d5dc2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -202,9 +202,9 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, public static final String ENUM_PROPERTY_NAMING = "enumPropertyNaming"; public static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'"; - public static final String SERIALIZATION_ENGINE = "serializationEngine"; - public static final String SERIALIZATION_ENGINE_DESC = "What serialization engine to use: 'moshi' (default), or 'gson'"; - public static enum SERIALIZATION_ENGINE_TYPE {moshi, gson} + public static final String SERIALIZATION_LIBRARY = "serializationLibrary"; + public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson'"; + public static enum SERIALIZATION_LIBRARY_TYPE {moshi, gson} public static final String MODEL_NAME_PREFIX = "modelNamePrefix"; public static final String MODEL_NAME_PREFIX_DESC = "Prefix that will be prepended to all model names."; 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 7206b1c2fe48..4be40cc5ff71 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 @@ -51,7 +51,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co protected boolean parcelizeModels = false; protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase; - protected CodegenConstants.SERIALIZATION_ENGINE_TYPE serializationEngine = CodegenConstants.SERIALIZATION_ENGINE_TYPE.moshi; + protected CodegenConstants.SERIALIZATION_LIBRARY_TYPE serializationLibrary = CodegenConstants.SERIALIZATION_LIBRARY_TYPE.moshi; public AbstractKotlinCodegen() { super(); @@ -207,8 +207,8 @@ public AbstractKotlinCodegen() { CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC); cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name())); - CliOption serializationEngineOpt = new CliOption(CodegenConstants.SERIALIZATION_ENGINE, CodegenConstants.SERIALIZATION_ENGINE_DESC); - cliOptions.add(serializationEngineOpt.defaultValue(serializationEngine.name())); + CliOption serializationLibraryOpt = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, CodegenConstants.SERIALIZATION_LIBRARY_DESC); + cliOptions.add(serializationLibraryOpt.defaultValue(serializationLibrary.name())); cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC)); } @@ -249,8 +249,8 @@ public CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming() { return this.enumPropertyNaming; } - public CodegenConstants.SERIALIZATION_ENGINE_TYPE getSerializationEngine() { - return this.serializationEngine; + public CodegenConstants.SERIALIZATION_LIBRARY_TYPE getSerializationLibrary() { + return this.serializationLibrary; } /** @@ -273,14 +273,14 @@ public void setEnumPropertyNaming(final String enumPropertyNamingType) { /** * Sets the serialization engine for Kotlin * - * @param enumSerializationEngine The string representation of the serialization engine as defined by {@link CodegenConstants.SERIALIZATION_ENGINE_TYPE} + * @param enumSerializationLibrary The string representation of the serialization library as defined by {@link CodegenConstants.SERIALIZATION_LIBRARY_TYPE} */ - public void setSerializationEngine(final String enumSerializationEngine) { + public void setSerializationLibrary(final String enumSerializationLibrary) { try { - this.serializationEngine = CodegenConstants.SERIALIZATION_ENGINE_TYPE.valueOf(enumSerializationEngine); + this.serializationLibrary = CodegenConstants.SERIALIZATION_LIBRARY_TYPE.valueOf(enumSerializationLibrary); } catch (IllegalArgumentException ex) { - StringBuilder sb = new StringBuilder(enumSerializationEngine + " is an invalid enum property naming option. Please choose from:"); - for (CodegenConstants.SERIALIZATION_ENGINE_TYPE t : CodegenConstants.SERIALIZATION_ENGINE_TYPE.values()) { + StringBuilder sb = new StringBuilder(enumSerializationLibrary + " is an invalid enum property naming option. Please choose from:"); + for (CodegenConstants.SERIALIZATION_LIBRARY_TYPE t : CodegenConstants.SERIALIZATION_LIBRARY_TYPE.values()) { sb.append("\n ").append(t.name()); } throw new RuntimeException(sb.toString()); @@ -356,12 +356,12 @@ public void processOpts() { setEnumPropertyNaming((String) additionalProperties.get(CodegenConstants.ENUM_PROPERTY_NAMING)); } - if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_ENGINE)) { - setSerializationEngine((String) additionalProperties.get(CodegenConstants.SERIALIZATION_ENGINE)); - additionalProperties.put(this.serializationEngine.name(), true); + if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) { + setSerializationLibrary((String) additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY)); + additionalProperties.put(this.serializationLibrary.name(), true); } else { - additionalProperties.put(this.serializationEngine.name(), true); + additionalProperties.put(this.serializationLibrary.name(), true); } if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache index c444a8590cb3..7312c4f3fdc4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache @@ -1,6 +1,10 @@ {{#description}} /* {{{description}}} */ {{/description}} - {{#moshi}}@Json(name = "{{{baseName}}}"){{/moshi}} - {{#gson}}@SerializedName("{{name}}"){{/gson}} + {{#moshi}} + @Json(name = "{{{baseName}}}") + {{/moshi}} + {{#gson}} + @SerializedName("{{name}}") + {{/gson}} val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache index 8223c9391c1c..223bf5904b49 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache @@ -1,6 +1,10 @@ {{#description}} /* {{{description}}} */ {{/description}} - {{#moshi}}@Json(name = "{{{baseName}}}"){{/moshi}} - {{#gson}}@SerializedName("{{name}}"){{/gson}} + {{#moshi}} + @Json(name = "{{{baseName}}}") + {{/moshi}} + {{#gson}} + @SerializedName("{{name}}") + {{/gson}} val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 97fb9678c869..b8b15769853e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,13 +21,10 @@ import com.squareup.moshi.Json */ data class ApiResponse ( @Json(name = "code") - val code: kotlin.Int? = null, @Json(name = "type") - val type: kotlin.String? = null, @Json(name = "message") - val message: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index 5f84a3f886e8..2cb38b9fba51 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class Category ( @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "name") - val name: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index 3a4d44310a17..e77abd68d517 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,23 +24,17 @@ import com.squareup.moshi.Json */ 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.LocalDateTime? = null, /* Order Status */ @Json(name = "status") - val status: Order.Status? = null, @Json(name = "complete") - val complete: kotlin.Boolean? = null ) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index 929a8a5133bb..9ee00ac631e4 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,23 +26,17 @@ import com.squareup.moshi.Json */ data class Pet ( @Json(name = "name") - val name: kotlin.String, @Json(name = "photoUrls") - val photoUrls: kotlin.Array, @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "category") - val category: Category? = null, @Json(name = "tags") - val tags: kotlin.Array? = null, /* pet status in the store */ @Json(name = "status") - val status: Pet.Status? = null ) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index b27f59b4f668..475acce8a0a9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class Tag ( @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "name") - val name: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index df433469cc23..0cc681309b45 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,29 +26,21 @@ import com.squareup.moshi.Json */ data class User ( @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "username") - val username: kotlin.String? = null, @Json(name = "firstName") - val firstName: kotlin.String? = null, @Json(name = "lastName") - val lastName: kotlin.String? = null, @Json(name = "email") - val email: kotlin.String? = null, @Json(name = "password") - val password: kotlin.String? = null, @Json(name = "phone") - val phone: kotlin.String? = null, /* User Status */ @Json(name = "userStatus") - val userStatus: kotlin.Int? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt index 8a9ac8e5e796..7d5ee7a1bb7f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class AdditionalPropertiesClass ( @Json(name = "map_property") - val mapProperty: kotlin.collections.Map? = null, @Json(name = "map_of_map_property") - val mapOfMapProperty: kotlin.collections.Map>? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt index d8d7435a62d8..5f4435f56fa4 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class Animal ( @Json(name = "className") - val className: kotlin.String, @Json(name = "color") - val color: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 953908f87e2f..0fe4589a5f4f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,13 +21,10 @@ import com.squareup.moshi.Json */ data class ApiResponse ( @Json(name = "code") - val code: kotlin.Int? = null, @Json(name = "type") - val type: kotlin.String? = null, @Json(name = "message") - val message: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt index 54c0e4f06e91..7ade7d8cff50 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class ArrayOfArrayOfNumberOnly ( @Json(name = "ArrayArrayNumber") - val arrayArrayNumber: kotlin.Array>? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt index e2202ff96b20..263146cfd9cf 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class ArrayOfNumberOnly ( @Json(name = "ArrayNumber") - val arrayNumber: kotlin.Array? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt index 314bdd19252f..a430c0559325 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt @@ -22,13 +22,10 @@ import com.squareup.moshi.Json */ data class ArrayTest ( @Json(name = "array_of_string") - val arrayOfString: kotlin.Array? = null, @Json(name = "array_array_of_integer") - val arrayArrayOfInteger: kotlin.Array>? = null, @Json(name = "array_array_of_model") - val arrayArrayOfModel: kotlin.Array>? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt index 5ecc603f152d..72b27a545076 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt @@ -24,23 +24,17 @@ import com.squareup.moshi.Json */ data class Capitalization ( @Json(name = "smallCamel") - val smallCamel: kotlin.String? = null, @Json(name = "CapitalCamel") - val capitalCamel: kotlin.String? = null, @Json(name = "small_Snake") - val smallSnake: kotlin.String? = null, @Json(name = "Capital_Snake") - val capitalSnake: kotlin.String? = null, @Json(name = "SCA_ETH_Flow_Points") - val scAETHFlowPoints: kotlin.String? = null, /* Name of the pet */ @Json(name = "ATT_NAME") - val ATT_NAME: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt index f493dc2735de..1ce9e6ef4315 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt @@ -21,13 +21,10 @@ import com.squareup.moshi.Json */ data class Cat ( @Json(name = "className") - val className: kotlin.String, @Json(name = "declawed") - val declawed: kotlin.Boolean? = null, @Json(name = "color") - val color: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt index e2e155c8f6d4..ec9862cd1757 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/CatAllOf.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class CatAllOf ( @Json(name = "declawed") - val declawed: kotlin.Boolean? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index 016b7b48b8c3..059231f463c0 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class Category ( @Json(name = "name") - val name: kotlin.String, @Json(name = "id") - val id: kotlin.Long? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt index 6567266b71ed..06245c42beb4 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class ClassModel ( @Json(name = "_class") - val propertyClass: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt index f7e72ce333e9..4a0cc69a783c 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class Client ( @Json(name = "client") - val client: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt index 3b8af4c15cbc..19cb002da7e8 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt @@ -21,13 +21,10 @@ import com.squareup.moshi.Json */ data class Dog ( @Json(name = "className") - val className: kotlin.String, @Json(name = "breed") - val breed: kotlin.String? = null, @Json(name = "color") - val color: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt index 51d35e978cab..71b1b71365af 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DogAllOf.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class DogAllOf ( @Json(name = "breed") - val breed: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt index 75ecfa8c887c..862929784c01 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class EnumArrays ( @Json(name = "just_symbol") - val justSymbol: EnumArrays.JustSymbol? = null, @Json(name = "array_enum") - val arrayEnum: kotlin.Array? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt index 3c54820bd163..5c4073650378 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt @@ -30,28 +30,20 @@ import com.squareup.moshi.Json */ data class EnumTest ( @Json(name = "enum_string_required") - val enumStringRequired: EnumTest.EnumStringRequired, @Json(name = "enum_string") - val enumString: EnumTest.EnumString? = null, @Json(name = "enum_integer") - val enumInteger: EnumTest.EnumInteger? = null, @Json(name = "enum_number") - val enumNumber: EnumTest.EnumNumber? = null, @Json(name = "outerEnum") - val outerEnum: OuterEnum? = null, @Json(name = "outerEnumInteger") - val outerEnumInteger: OuterEnumInteger? = null, @Json(name = "outerEnumDefaultValue") - val outerEnumDefaultValue: OuterEnumDefaultValue? = null, @Json(name = "outerEnumIntegerDefaultValue") - val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt index 9d9a93a9d4c5..82e56661014b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class FileSchemaTestClass ( @Json(name = "file") - val file: java.io.File? = null, @Json(name = "files") - val files: kotlin.Array? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt index 7abdc119c34e..4ac59867244b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class Foo ( @Json(name = "bar") - val bar: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index b2f3f5b1d057..d185226b0dc0 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -33,51 +33,36 @@ import com.squareup.moshi.Json */ data class FormatTest ( @Json(name = "number") - val number: java.math.BigDecimal, @Json(name = "byte") - val byte: kotlin.ByteArray, @Json(name = "date") - val date: java.time.LocalDate, @Json(name = "password") - val password: kotlin.String, @Json(name = "integer") - val integer: kotlin.Int? = null, @Json(name = "int32") - val int32: kotlin.Int? = null, @Json(name = "int64") - val int64: kotlin.Long? = null, @Json(name = "float") - val float: kotlin.Float? = null, @Json(name = "double") - val double: kotlin.Double? = null, @Json(name = "string") - val string: kotlin.String? = null, @Json(name = "binary") - val binary: java.io.File? = null, @Json(name = "dateTime") - val dateTime: java.time.LocalDateTime? = null, @Json(name = "uuid") - val uuid: java.util.UUID? = null, /* A string that is a 10 digit number. Can have leading zeros. */ @Json(name = "pattern_with_digits") - val patternWithDigits: kotlin.String? = null, /* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */ @Json(name = "pattern_with_digits_and_delimiter") - val patternWithDigitsAndDelimiter: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt index 6d72adf6501f..1e649d71f249 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class HasOnlyReadOnly ( @Json(name = "bar") - val bar: kotlin.String? = null, @Json(name = "foo") - val foo: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt index 22b2b7cc839c..8f53541bd227 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class HealthCheckResult ( @Json(name = "NullableMessage") - val nullableMessage: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt index b7eb1777463e..70484e689460 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject.kt @@ -21,11 +21,9 @@ import com.squareup.moshi.Json data class InlineObject ( /* Updated name of the pet */ @Json(name = "name") - val name: kotlin.String? = null, /* Updated status of the pet */ @Json(name = "status") - val status: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt index 61da4d727d6b..51f2137de920 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject1.kt @@ -21,11 +21,9 @@ import com.squareup.moshi.Json data class InlineObject1 ( /* Additional data to pass to server */ @Json(name = "additionalMetadata") - val additionalMetadata: kotlin.String? = null, /* file to upload */ @Json(name = "file") - val file: java.io.File? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt index b5fc7378f4cf..0f982f05a809 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt @@ -21,11 +21,9 @@ import com.squareup.moshi.Json data class InlineObject2 ( /* Form parameter enum test (string array) */ @Json(name = "enum_form_string_array") - val enumFormStringArray: kotlin.Array? = null, /* Form parameter enum test (string) */ @Json(name = "enum_form_string") - val enumFormString: InlineObject2.EnumFormString? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt index be6efba09577..35dc49df571f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject3.kt @@ -33,59 +33,45 @@ import com.squareup.moshi.Json data class InlineObject3 ( /* None */ @Json(name = "number") - val number: java.math.BigDecimal, /* None */ @Json(name = "double") - val double: kotlin.Double, /* None */ @Json(name = "pattern_without_delimiter") - val patternWithoutDelimiter: kotlin.String, /* None */ @Json(name = "byte") - val byte: kotlin.ByteArray, /* None */ @Json(name = "integer") - val integer: kotlin.Int? = null, /* None */ @Json(name = "int32") - val int32: kotlin.Int? = null, /* None */ @Json(name = "int64") - val int64: kotlin.Long? = null, /* None */ @Json(name = "float") - val float: kotlin.Float? = null, /* None */ @Json(name = "string") - val string: kotlin.String? = null, /* None */ @Json(name = "binary") - val binary: java.io.File? = null, /* None */ @Json(name = "date") - val date: java.time.LocalDate? = null, /* None */ @Json(name = "dateTime") - val dateTime: java.time.LocalDateTime? = null, /* None */ @Json(name = "password") - val password: kotlin.String? = null, /* None */ @Json(name = "callback") - val callback: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt index e571e052b106..52eef17034ac 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject4.kt @@ -21,11 +21,9 @@ import com.squareup.moshi.Json data class InlineObject4 ( /* field1 */ @Json(name = "param") - val param: kotlin.String, /* field2 */ @Json(name = "param2") - val param2: kotlin.String ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt index 8f87948e875b..ca95c5ee037e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject5.kt @@ -21,11 +21,9 @@ import com.squareup.moshi.Json data class InlineObject5 ( /* file to upload */ @Json(name = "requiredFile") - val requiredFile: java.io.File, /* Additional data to pass to server */ @Json(name = "additionalMetadata") - val additionalMetadata: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt index 9eab8b4be387..5768639b0b22 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt @@ -20,7 +20,6 @@ import com.squareup.moshi.Json */ data class InlineResponseDefault ( @Json(name = "string") - val string: Foo? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt index 1820df36ba42..6e2a75355bdc 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class List ( @Json(name = "123-list") - val `123minusList`: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt index ce69f2cb4d41..dc1096dc70b1 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt @@ -22,16 +22,12 @@ import com.squareup.moshi.Json */ data class MapTest ( @Json(name = "map_map_of_string") - val mapMapOfString: kotlin.collections.Map>? = null, @Json(name = "map_of_enum_string") - val mapOfEnumString: MapTest.MapOfEnumString? = null, @Json(name = "direct_map") - val directMap: kotlin.collections.Map? = null, @Json(name = "indirect_map") - val indirectMap: kotlin.collections.Map? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt index 5a2ad3cc609d..7d835a2af541 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt @@ -22,13 +22,10 @@ import com.squareup.moshi.Json */ data class MixedPropertiesAndAdditionalPropertiesClass ( @Json(name = "uuid") - val uuid: java.util.UUID? = null, @Json(name = "dateTime") - val dateTime: java.time.LocalDateTime? = null, @Json(name = "map") - val map: kotlin.collections.Map? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt index 923711beb6e5..b2e792c8e8e8 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class Model200Response ( @Json(name = "name") - val name: kotlin.Int? = null, @Json(name = "class") - val propertyClass: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt index 6cc4dde15d51..72cb9d7ad64b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt @@ -22,16 +22,12 @@ import com.squareup.moshi.Json */ data class Name ( @Json(name = "name") - val name: kotlin.Int, @Json(name = "snake_case") - val snakeCase: kotlin.Int? = null, @Json(name = "property") - val property: kotlin.String? = null, @Json(name = "123Number") - val `123number`: kotlin.Int? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt index b61b88b8e6d6..86bb11c5c1d9 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt @@ -30,40 +30,28 @@ import com.squareup.moshi.Json */ data class NullableClass ( @Json(name = "integer_prop") - val integerProp: kotlin.Int? = null, @Json(name = "number_prop") - val numberProp: java.math.BigDecimal? = null, @Json(name = "boolean_prop") - val booleanProp: kotlin.Boolean? = null, @Json(name = "string_prop") - val stringProp: kotlin.String? = null, @Json(name = "date_prop") - val dateProp: java.time.LocalDate? = null, @Json(name = "datetime_prop") - val datetimeProp: java.time.LocalDateTime? = null, @Json(name = "array_nullable_prop") - val arrayNullableProp: kotlin.Array? = null, @Json(name = "array_and_items_nullable_prop") - val arrayAndItemsNullableProp: kotlin.Array? = null, @Json(name = "array_items_nullable") - val arrayItemsNullable: kotlin.Array? = null, @Json(name = "object_nullable_prop") - val objectNullableProp: kotlin.collections.Map? = null, @Json(name = "object_and_items_nullable_prop") - val objectAndItemsNullableProp: kotlin.collections.Map? = null, @Json(name = "object_items_nullable") - val objectItemsNullable: kotlin.collections.Map? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt index 6eda326e0056..7385bd952314 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class NumberOnly ( @Json(name = "JustNumber") - val justNumber: java.math.BigDecimal? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index 6b82b62382ad..d33f3bf23935 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,23 +24,17 @@ import com.squareup.moshi.Json */ 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.LocalDateTime? = null, /* Order Status */ @Json(name = "status") - val status: Order.Status? = null, @Json(name = "complete") - val complete: kotlin.Boolean? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt index c0ce5c1d9a9e..304f88c52df4 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt @@ -21,13 +21,10 @@ import com.squareup.moshi.Json */ data class OuterComposite ( @Json(name = "my_number") - val myNumber: java.math.BigDecimal? = null, @Json(name = "my_string") - val myString: kotlin.String? = null, @Json(name = "my_boolean") - val myBoolean: kotlin.Boolean? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index f59712f5933d..b0c73cfb5144 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,23 +26,17 @@ import com.squareup.moshi.Json */ data class Pet ( @Json(name = "name") - val name: kotlin.String, @Json(name = "photoUrls") - val photoUrls: kotlin.Array, @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "category") - val category: Category? = null, @Json(name = "tags") - val tags: kotlin.Array? = null, /* pet status in the store */ @Json(name = "status") - val status: Pet.Status? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt index 3a87426b4912..52bf083649ae 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class ReadOnlyFirst ( @Json(name = "bar") - val bar: kotlin.String? = null, @Json(name = "baz") - val baz: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt index 4e7d8201056a..91c531468436 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class Return ( @Json(name = "return") - val `return`: kotlin.Int? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index 4e6a8f606b39..a4faf3fd57a5 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.Json */ data class SpecialModelname ( @Json(name = "$special[property.name]") - val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index b26df9ef63f7..37e9e0eaef3d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,10 +20,8 @@ import com.squareup.moshi.Json */ data class Tag ( @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "name") - val name: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index 320c519144db..5301e72d3763 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,29 +26,21 @@ import com.squareup.moshi.Json */ data class User ( @Json(name = "id") - val id: kotlin.Long? = null, @Json(name = "username") - val username: kotlin.String? = null, @Json(name = "firstName") - val firstName: kotlin.String? = null, @Json(name = "lastName") - val lastName: kotlin.String? = null, @Json(name = "email") - val email: kotlin.String? = null, @Json(name = "password") - val password: kotlin.String? = null, @Json(name = "phone") - val phone: kotlin.String? = null, /* User Status */ @Json(name = "userStatus") - val userStatus: kotlin.Int? = null ) From 7c01afd3d7b425d4bdde02d7bfd4f074bb73840b Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Tue, 27 Aug 2019 23:41:33 -0400 Subject: [PATCH 5/8] fixed javadoc warning. sigh. --- .../openapitools/codegen/languages/AbstractKotlinCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4be40cc5ff71..daaefc8b5c63 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 @@ -273,7 +273,7 @@ public void setEnumPropertyNaming(final String enumPropertyNamingType) { /** * Sets the serialization engine for Kotlin * - * @param enumSerializationLibrary The string representation of the serialization library as defined by {@link CodegenConstants.SERIALIZATION_LIBRARY_TYPE} + * @param enumSerializationLibrary The string representation of the serialization library as defined by {@link org.openapitools.codegen.CodegenConstants.SERIALIZATION_LIBRARY_TYPE} */ public void setSerializationLibrary(final String enumSerializationLibrary) { try { From bfb8701b09f9c5b53ed3c1ee7f327c4ffe63ed81 Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Wed, 28 Aug 2019 08:59:05 -0400 Subject: [PATCH 6/8] moved serializationLibrary Kotlin specific values to AbstractKotlinCodegen. I picked this layer instead of KotlinClient to make it available to the server in the future. In this commit, I've also updated kotlin.md to document serializationLibrary kotlin options. Testing: re-run mvn clean install and mvn verify --- docs/generators/kotlin.md | 1 + .../openapitools/codegen/CodegenConstants.java | 4 ++-- .../languages/AbstractKotlinCodegen.java | 17 +++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index 008cf3ccce91..ea8429590bd0 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -17,3 +17,4 @@ sidebar_label: kotlin |parcelizeModels|toggle "@Parcelize" for generated models| |null| |dateLibrary|Option. Date library to use|
**string**
String
**java8**
Java 8 native JSR310
**threetenbp**
Threetenbp
|java8| |collectionType|Option. Collection type to use|
**array**
kotlin.Array
**list**
kotlin.collections.List
|array| +|serializationLibrary|Option. JSON serialization library to use|
**moshi**
https://github.com/square/moshi
**gson**
https://github.com/google/gson
|moshi| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index db77041d5dc2..b200139faa99 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -202,9 +202,9 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, public static final String ENUM_PROPERTY_NAMING = "enumPropertyNaming"; public static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'"; + // Allow different language generators to offer an option of serialization library. Each language specific + // Codegen constants should define a description and provide proper input validation for the value of serializationLibrary public static final String SERIALIZATION_LIBRARY = "serializationLibrary"; - public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson'"; - public static enum SERIALIZATION_LIBRARY_TYPE {moshi, gson} public static final String MODEL_NAME_PREFIX = "modelNamePrefix"; public static final String MODEL_NAME_PREFIX_DESC = "Prefix that will be prepended to all model names."; 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 daaefc8b5c63..5351c1fe2d40 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 @@ -35,6 +35,10 @@ import static org.openapitools.codegen.utils.StringUtils.*; public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig { + + public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson'"; + public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson} + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class); protected String artifactId; @@ -51,7 +55,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co protected boolean parcelizeModels = false; protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase; - protected CodegenConstants.SERIALIZATION_LIBRARY_TYPE serializationLibrary = CodegenConstants.SERIALIZATION_LIBRARY_TYPE.moshi; + protected SERIALIZATION_LIBRARY_TYPE serializationLibrary = SERIALIZATION_LIBRARY_TYPE.moshi; public AbstractKotlinCodegen() { super(); @@ -207,7 +211,7 @@ public AbstractKotlinCodegen() { CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC); cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name())); - CliOption serializationLibraryOpt = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, CodegenConstants.SERIALIZATION_LIBRARY_DESC); + CliOption serializationLibraryOpt = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, SERIALIZATION_LIBRARY_DESC); cliOptions.add(serializationLibraryOpt.defaultValue(serializationLibrary.name())); cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC)); @@ -249,7 +253,7 @@ public CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming() { return this.enumPropertyNaming; } - public CodegenConstants.SERIALIZATION_LIBRARY_TYPE getSerializationLibrary() { + public SERIALIZATION_LIBRARY_TYPE getSerializationLibrary() { return this.serializationLibrary; } @@ -273,14 +277,15 @@ public void setEnumPropertyNaming(final String enumPropertyNamingType) { /** * Sets the serialization engine for Kotlin * - * @param enumSerializationLibrary The string representation of the serialization library as defined by {@link org.openapitools.codegen.CodegenConstants.SERIALIZATION_LIBRARY_TYPE} + * @param enumSerializationLibrary The string representation of the serialization library as defined by + * {@link org.openapitools.codegen.languages.AbstractKotlinCodegen.SERIALIZATION_LIBRARY_TYPE} */ public void setSerializationLibrary(final String enumSerializationLibrary) { try { - this.serializationLibrary = CodegenConstants.SERIALIZATION_LIBRARY_TYPE.valueOf(enumSerializationLibrary); + this.serializationLibrary = SERIALIZATION_LIBRARY_TYPE.valueOf(enumSerializationLibrary); } catch (IllegalArgumentException ex) { StringBuilder sb = new StringBuilder(enumSerializationLibrary + " is an invalid enum property naming option. Please choose from:"); - for (CodegenConstants.SERIALIZATION_LIBRARY_TYPE t : CodegenConstants.SERIALIZATION_LIBRARY_TYPE.values()) { + for (SERIALIZATION_LIBRARY_TYPE t : SERIALIZATION_LIBRARY_TYPE.values()) { sb.append("\n ").append(t.name()); } throw new RuntimeException(sb.toString()); From 6c04364f356a984723487774bfd02232354eeeff Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Wed, 28 Aug 2019 15:40:43 -0400 Subject: [PATCH 7/8] re-generated samples and docs directory --- docs/generators/kotlin.md | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 3 +-- .../org/openapitools/client/models/Category.kt | 3 +-- .../kotlin/org/openapitools/client/models/Order.kt | 14 ++++++-------- .../kotlin/org/openapitools/client/models/Pet.kt | 14 ++++++-------- .../kotlin/org/openapitools/client/models/Tag.kt | 3 +-- .../kotlin/org/openapitools/client/models/User.kt | 3 +-- .../org/openapitools/client/models/ApiResponse.kt | 3 +-- .../org/openapitools/client/models/Category.kt | 3 +-- .../kotlin/org/openapitools/client/models/Order.kt | 14 ++++++-------- .../kotlin/org/openapitools/client/models/Pet.kt | 14 ++++++-------- .../kotlin/org/openapitools/client/models/Tag.kt | 3 +-- .../kotlin/org/openapitools/client/models/User.kt | 3 +-- 13 files changed, 33 insertions(+), 49 deletions(-) diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index ea8429590bd0..ccf17bb6eccb 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -14,7 +14,7 @@ sidebar_label: kotlin |artifactId|Generated artifact id (name of jar).| |kotlin-client| |artifactVersion|Generated artifact's package version.| |1.0.0| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |dateLibrary|Option. Date library to use|
**string**
String
**java8**
Java 8 native JSR310
**threetenbp**
Threetenbp
|java8| |collectionType|Option. Collection type to use|
**array**
kotlin.Array
**list**
kotlin.collections.List
|array| -|serializationLibrary|Option. JSON serialization library to use|
**moshi**
https://github.com/square/moshi
**gson**
https://github.com/google/gson
|moshi| diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 47109faf6125..b8b15769853e 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -26,7 +26,6 @@ data class ApiResponse ( val type: kotlin.String? = null, @Json(name = "message") val message: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt index f068a02b1a03..2cb38b9fba51 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -23,7 +23,6 @@ data class Category ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt index a263c25f33c2..d979b8b691a4 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -36,24 +36,22 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) { +) +{ /** * Order Status * Values: placed,approved,delivered */ enum class Status(val value: kotlin.String){ - @Json(name = "placed") - placed("placed"), + @Json(name = "placed") placed("placed"), - @Json(name = "approved") - approved("approved"), + @Json(name = "approved") approved("approved"), - @Json(name = "delivered") - delivered("delivered"); + @Json(name = "delivered") delivered("delivered"); } - } + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index 88a536ea6227..9ee00ac631e4 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -38,24 +38,22 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) { +) +{ /** * pet status in the store * Values: available,pending,sold */ enum class Status(val value: kotlin.String){ - @Json(name = "available") - available("available"), + @Json(name = "available") available("available"), - @Json(name = "pending") - pending("pending"), + @Json(name = "pending") pending("pending"), - @Json(name = "sold") - sold("sold"); + @Json(name = "sold") sold("sold"); } - } + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt index e67b899b1ff8..475acce8a0a9 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -23,7 +23,6 @@ data class Tag ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt index 6a66d8e523b9..0cc681309b45 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt @@ -42,7 +42,6 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 47109faf6125..b8b15769853e 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -26,7 +26,6 @@ data class ApiResponse ( val type: kotlin.String? = null, @Json(name = "message") val message: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt index f068a02b1a03..2cb38b9fba51 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -23,7 +23,6 @@ data class Category ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt index 916fe3094b23..6f1657150d81 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -36,24 +36,22 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) { +) +{ /** * Order Status * Values: placed,approved,delivered */ enum class Status(val value: kotlin.String){ - @Json(name = "placed") - placed("placed"), + @Json(name = "placed") placed("placed"), - @Json(name = "approved") - approved("approved"), + @Json(name = "approved") approved("approved"), - @Json(name = "delivered") - delivered("delivered"); + @Json(name = "delivered") delivered("delivered"); } - } + diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt index 88a536ea6227..9ee00ac631e4 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -38,24 +38,22 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) { +) +{ /** * pet status in the store * Values: available,pending,sold */ enum class Status(val value: kotlin.String){ - @Json(name = "available") - available("available"), + @Json(name = "available") available("available"), - @Json(name = "pending") - pending("pending"), + @Json(name = "pending") pending("pending"), - @Json(name = "sold") - sold("sold"); + @Json(name = "sold") sold("sold"); } - } + diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt index e67b899b1ff8..475acce8a0a9 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -23,7 +23,6 @@ data class Tag ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) { +) -} diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt index 6a66d8e523b9..0cc681309b45 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt @@ -42,7 +42,6 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) { +) -} From bbcc2508b4f4078307caa2ca7b65431d09bd1f29 Mon Sep 17 00:00:00 2001 From: prisoneroftech Date: Wed, 28 Aug 2019 17:47:19 -0400 Subject: [PATCH 8/8] kotlin-server.md and kotlin-spring.md get generated out of kotlin.md --- docs/generators/kotlin-server.md | 1 + docs/generators/kotlin-spring.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md index 161ca6d0a967..4c18a6165c9d 100644 --- a/docs/generators/kotlin-server.md +++ b/docs/generators/kotlin-server.md @@ -14,6 +14,7 @@ sidebar_label: kotlin-server |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| +|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |library|library template (sub-template)|
**ktor**
ktor framework
|ktor| |featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true| diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index c194143dbfab..9b690b12da5a 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -14,6 +14,7 @@ sidebar_label: kotlin-spring |artifactId|Generated artifact id (name of jar).| |openapi-spring| |artifactVersion|Generated artifact's package version.| |1.0.0| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi| |parcelizeModels|toggle "@Parcelize" for generated models| |null| |title|server title name or client service name| |OpenAPI Kotlin Spring| |basePackage|base package (invokerPackage) for generated code| |org.openapitools|