diff --git a/bin/kotlin-client-petstore.sh b/bin/kotlin-client-petstore.sh index cad4be6995e0..409911eb1137 100755 --- a/bin/kotlin-client-petstore.sh +++ b/bin/kotlin-client-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/client/petstore/kotlin $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8,serializableModel=true -o samples/client/petstore/kotlin $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-client-string.sh b/bin/kotlin-client-string.sh index 410ddbab3999..57fae03ab11a 100755 --- a/bin/kotlin-client-string.sh +++ b/bin/kotlin-client-string.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string --additional-properties dateLibrary=string -o samples/client/petstore/kotlin-string $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string --additional-properties dateLibrary=string,serializableModel=true -o samples/client/petstore/kotlin-string $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-server-petstore.sh b/bin/kotlin-server-petstore.sh index dbdf48b2bbd3..755a560a1f1d 100755 --- a/bin/kotlin-server-petstore.sh +++ b/bin/kotlin-server-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor --additional-properties hideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor --additional-properties hideGenerationTimestamp=true,serializableModel=true $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-springboot-petstore-server.sh b/bin/kotlin-springboot-petstore-server.sh index 45179767ece5..73b56bcf8fa5 100755 --- a/bin/kotlin-springboot-petstore-server.sh +++ b/bin/kotlin-springboot-petstore-server.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/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true" +ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,serializableModel=true" echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot" rm -rf samples/server/petstore/kotlin-springboot diff --git a/bin/openapi3/kotlin-client-petstore.sh b/bin/openapi3/kotlin-client-petstore.sh index f426dba223b8..d03522768005 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,serializableModel=true -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 diff --git a/bin/openapi3/kotlin-springboot-petstore-server.sh b/bin/openapi3/kotlin-springboot-petstore-server.sh index b1320abdb0a3..8779e1a04122 100755 --- a/bin/openapi3/kotlin-springboot-petstore-server.sh +++ b/bin/openapi3/kotlin-springboot-petstore-server.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.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/openapi3/server/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true" +ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/openapi3/server/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,serializableModel=true" echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot" rm -rf samples/server/openapi3/petstore/kotlin-springboot diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md index 4c18a6165c9d..54e62dcf2087 100644 --- a/docs/generators/kotlin-server.md +++ b/docs/generators/kotlin-server.md @@ -16,6 +16,7 @@ sidebar_label: kotlin-server |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| +|serializableModel|boolean - toggle "implements Serializable" 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| |featureConditionalHeaders|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |false| diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 9b690b12da5a..ca5e09b8fbcf 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -16,6 +16,7 @@ sidebar_label: kotlin-spring |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| +|serializableModel|boolean - toggle "implements Serializable" for generated models| |null| |title|server title name or client service name| |OpenAPI Kotlin Spring| |basePackage|base package (invokerPackage) for generated code| |org.openapitools| |serverPort|configuration the port in which the sever is to run on| |8080| diff --git a/docs/generators/kotlin-vertx.md b/docs/generators/kotlin-vertx.md index 9677fe623926..03e2d0dd1fc8 100644 --- a/docs/generators/kotlin-vertx.md +++ b/docs/generators/kotlin-vertx.md @@ -16,3 +16,4 @@ sidebar_label: kotlin-vertx |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| +|serializableModel|boolean - toggle "implements Serializable" for generated models| |null| diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index 264842d4bb20..719ed37accb7 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -16,6 +16,7 @@ sidebar_label: kotlin |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| +|serializableModel|boolean - toggle "implements Serializable" for generated models| |null| |dateLibrary|Option. Date library to use|
**string**
String
**java8**
Java 8 native JSR310 (jvm only)
**threetenbp**
Threetenbp (jvm only)
|java8| |collectionType|Option. Collection type to use|
**array**
kotlin.Array
**list**
kotlin.collections.List
|array| |library|Library template (sub-template) to use|
**jvm**
Platform: Java Virtual Machine. HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1.
**multiplatform**
Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.
|jvm| 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 83be9eb9ce83..da9f4f14192c 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 @@ -54,6 +54,8 @@ public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson} protected String modelDocPath = "docs/"; protected boolean parcelizeModels = false; + protected boolean serializableModel = false; + protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase; protected SERIALIZATION_LIBRARY_TYPE serializationLibrary = SERIALIZATION_LIBRARY_TYPE.moshi; @@ -215,6 +217,7 @@ public AbstractKotlinCodegen() { cliOptions.add(serializationLibraryOpt.defaultValue(serializationLibrary.name())); cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC)); + cliOptions.add(new CliOption(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC)); } @Override @@ -411,6 +414,12 @@ public void processOpts() { LOGGER.warn(CodegenConstants.INVOKER_PACKAGE + " with " + this.getName() + " generator is ignored. Use " + CodegenConstants.PACKAGE_NAME + "."); } + if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) { + this.setSerializableModel(Boolean.valueOf((String) additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL))); + } else { + additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel); + } + if (additionalProperties.containsKey(CodegenConstants.PARCELIZE_MODELS)) { this.setParcelizeModels(Boolean.valueOf((String) additionalProperties.get(CodegenConstants.PARCELIZE_MODELS))); } else { @@ -460,6 +469,13 @@ public void setParcelizeModels(Boolean parcelizeModels) { this.parcelizeModels = parcelizeModels; } + public boolean isSerializableModel() { + return serializableModel; + } + + public void setSerializableModel(boolean serializableModel) { + this.serializableModel = serializableModel; + } /** * Return the sanitized variable name for enum * 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 abf77457445b..1cb58bb49e9e 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 @@ -15,6 +15,9 @@ import kotlinx.android.parcel.Parcelize import kotlinx.serialization.* import kotlinx.serialization.internal.CommonEnumSerializer {{/multiplatform}} +{{#serializableModel}} +import java.io.Serializable +{{/serializableModel}} /** * {{{description}}} {{#vars}} @@ -31,7 +34,9 @@ data class {{classname}} ( {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>data_class_opt_var}}{{^-last}}, {{/-last}}{{/optionalVars}} -){{#parcelizeModels}} : Parcelable{{/parcelizeModels}} +) {{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}} +{{^parcelizeModels}}{{#serializableModel}}: Serializable {{/serializableModel}}{{/parcelizeModels}} +{{#parcelizeModels}}{{#serializableModel}} : Parcelable, Serializable {{/serializableModel}}{{/parcelizeModels}} {{#hasEnums}} { {{#vars}}{{#isEnum}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/data_class.mustache index feb6a0b317e6..fe88e433f20d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/data_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/data_class.mustache @@ -3,6 +3,9 @@ import android.os.Parcelable import kotlinx.android.parcel.Parcelize {{/parcelizeModels}} +{{#serializableModel}} +import java.io.Serializable +{{/serializableModel}} /** * {{{description}}} {{#vars}} @@ -18,7 +21,10 @@ data class {{classname}} ( {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>data_class_opt_var}}{{^-last}}, {{/-last}}{{/optionalVars}} -){{#parcelizeModels}} : Parcelable{{/parcelizeModels}} { +) {{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}} +{{^parcelizeModels}}{{#serializableModel}}: Serializable {{/serializableModel}}{{/parcelizeModels}} +{{#parcelizeModels}}{{#serializableModel}} : Parcelable, Serializable {{/serializableModel}}{{/parcelizeModels}} +{ {{#hasEnums}}{{#vars}}{{#isEnum}} /** * {{{description}}} diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt index 51ab6ed93980..3f05f17779e7 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -25,5 +25,7 @@ data class ApiResponse ( @SerialName(value = "code") val code: kotlin.Int? = null, @SerialName(value = "type") val type: kotlin.String? = null, @SerialName(value = "message") val message: kotlin.String? = null -) +) + + diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt index 96432c658ada..eff7d12a4abd 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt @@ -23,5 +23,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer data class Category ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "name") val name: kotlin.String? = null -) +) + + diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt index e949395ce4ef..76b9cf068ed9 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt @@ -32,7 +32,9 @@ data class Order ( /* Order Status */ @SerialName(value = "status") val status: Order.Status? = null, @SerialName(value = "complete") val complete: kotlin.Boolean? = null -) +) + + { /** diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt index dc2f8b0b0ef3..145683fe5784 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt @@ -34,7 +34,9 @@ data class Pet ( @SerialName(value = "tags") val tags: kotlin.Array? = null, /* pet status in the store */ @SerialName(value = "status") val status: Pet.Status? = null -) +) + + { /** diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt index b21e51bf8d3b..6c5ce642e78e 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt @@ -23,5 +23,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer data class Tag ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "name") val name: kotlin.String? = null -) +) + + diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt index 7d52e737d49e..dd092dfd7074 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt @@ -36,5 +36,7 @@ data class User ( @SerialName(value = "phone") val phone: kotlin.String? = null, /* User Status */ @SerialName(value = "userStatus") val userStatus: kotlin.Int? = null -) +) + + 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 ada15fee7a1b..6d5c231ccc84 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Describes the result of uploading an image resource * @param code @@ -27,5 +28,7 @@ data class ApiResponse ( val type: kotlin.String? = null, @Json(name = "message") val message: kotlin.String? = null -) +) +: Serializable + 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 426a0e515928..1fe92af826c1 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * A category for a pet * @param id @@ -24,5 +25,7 @@ data class Category ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) +) +: Serializable + 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 38be465c021b..81cc2b0940b0 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * An order for a pets from the pet store * @param id @@ -37,7 +38,9 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) +) +: Serializable + { /** 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 d870b69e5e7f..3b4dfc22abdc 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 @@ -15,6 +15,7 @@ import org.openapitools.client.models.Category import org.openapitools.client.models.Tag import com.squareup.moshi.Json +import java.io.Serializable /** * A pet for sale in the pet store * @param id @@ -39,7 +40,9 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) +) +: Serializable + { /** 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 f9ef87e13fbf..1d97954c460b 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * A tag for a pet * @param id @@ -24,5 +25,7 @@ data class Tag ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) +) +: Serializable + 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 dfd63806da94..df835a5d9685 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * A User who is purchasing from the pet store * @param id @@ -43,5 +44,7 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) +) +: Serializable + 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 ada15fee7a1b..47766821f186 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 @@ -27,5 +27,7 @@ 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 426a0e515928..edb16cc1270a 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 @@ -24,5 +24,7 @@ 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 abf5219de339..af6dcb45604f 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 @@ -37,7 +37,9 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) +) + + { /** 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 d870b69e5e7f..8015b6dab720 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 @@ -39,7 +39,9 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) +) + + { /** 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 f9ef87e13fbf..05dc7c9afefe 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 @@ -24,5 +24,7 @@ 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 dfd63806da94..537b01d3c278 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 @@ -43,5 +43,7 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) +) + + 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 ada15fee7a1b..6d5c231ccc84 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Describes the result of uploading an image resource * @param code @@ -27,5 +28,7 @@ data class ApiResponse ( val type: kotlin.String? = null, @Json(name = "message") val message: kotlin.String? = null -) +) +: Serializable + 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 426a0e515928..1fe92af826c1 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * A category for a pet * @param id @@ -24,5 +25,7 @@ data class Category ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) +) +: Serializable + 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 2e9074a650ab..a5478a616261 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * An order for a pets from the pet store * @param id @@ -37,7 +38,9 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) +) +: Serializable + { /** 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 d870b69e5e7f..3b4dfc22abdc 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 @@ -15,6 +15,7 @@ import org.openapitools.client.models.Category import org.openapitools.client.models.Tag import com.squareup.moshi.Json +import java.io.Serializable /** * A pet for sale in the pet store * @param id @@ -39,7 +40,9 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) +) +: Serializable + { /** 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 f9ef87e13fbf..1d97954c460b 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * A tag for a pet * @param id @@ -24,5 +25,7 @@ data class Tag ( val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) +) +: Serializable + 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 dfd63806da94..df835a5d9685 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * A User who is purchasing from the pet store * @param id @@ -43,5 +44,7 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) +) +: Serializable + diff --git a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION index 2f81801b7943..d99e7162d01f 100644 --- a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION @@ -1 +1 @@ -4.1.1-SNAPSHOT \ No newline at end of file +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin/README.md b/samples/openapi3/client/petstore/kotlin/README.md index cf1793ec2f6f..3738c4b9c91f 100644 --- a/samples/openapi3/client/petstore/kotlin/README.md +++ b/samples/openapi3/client/petstore/kotlin/README.md @@ -2,8 +2,8 @@ ## Requires -* Kotlin 1.1.2 -* Gradle 3.3 +* Kotlin 1.3.41 +* Gradle 4.9 ## Build @@ -50,6 +50,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) *FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-paramters | *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet diff --git a/samples/openapi3/client/petstore/kotlin/build.gradle b/samples/openapi3/client/petstore/kotlin/build.gradle index 8668dab3a7e6..c09f7912cfe1 100644 --- a/samples/openapi3/client/petstore/kotlin/build.gradle +++ b/samples/openapi3/client/petstore/kotlin/build.gradle @@ -1,13 +1,13 @@ group 'org.openapitools' version '1.0.0' -task wrapper(type: Wrapper) { - gradleVersion = '3.3' +wrapper { + gradleVersion = '4.9' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.1.2' + ext.kotlin_version = '1.3.41' repositories { mavenCentral() @@ -23,11 +23,15 @@ repositories { mavenCentral() } +test { + useJUnitPlatform() +} + dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.5.0" - compile "com.squareup.moshi:moshi-adapters:1.5.0" - compile "com.squareup.okhttp3:okhttp:3.8.0" - compile "org.threeten:threetenbp:1.3.6" - testCompile "io.kotlintest:kotlintest:2.0.2" + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + 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" + compile "com.squareup.okhttp3:okhttp:4.0.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.1.0" } diff --git a/samples/openapi3/client/petstore/kotlin/settings.gradle b/samples/openapi3/client/petstore/kotlin/settings.gradle index 17e020387e21..7540d01de36c 100644 --- a/samples/openapi3/client/petstore/kotlin/settings.gradle +++ b/samples/openapi3/client/petstore/kotlin/settings.gradle @@ -1 +1,2 @@ + rootProject.name = 'kotlin-petstore-client' \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index c2c3f1f0eaea..f97cb88d2338 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -12,9 +12,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: List, collectionFormat: String, map: (item: Any?) -> String = defaultMultiValueConverter): List { +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) - else -> listOf(items.map(map).joinToString(separator = collectionDelimiter(collectionFormat))) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) } } \ No newline at end of file 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 7d5ee7a1bb7f..4367965e2dca 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param mapProperty * @param mapOfMapProperty */ + 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 -) +) +: Serializable 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 5f4435f56fa4..ba590f165b8d 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param className * @param color */ + data class Animal ( @Json(name = "className") val className: kotlin.String, @Json(name = "color") val color: kotlin.String? = null -) +) +: Serializable 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 0fe4589a5f4f..22773e65057f 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 @@ -13,12 +13,14 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param code * @param type * @param message */ + data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @@ -26,6 +28,7 @@ data class ApiResponse ( val type: kotlin.String? = null, @Json(name = "message") val message: kotlin.String? = null -) +) +: Serializable 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 7ade7d8cff50..5c9048466e04 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param arrayArrayNumber */ + data class ArrayOfArrayOfNumberOnly ( @Json(name = "ArrayArrayNumber") val arrayArrayNumber: kotlin.Array>? = null -) +) +: Serializable 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 263146cfd9cf..214ef4b0cfe3 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param arrayNumber */ + data class ArrayOfNumberOnly ( @Json(name = "ArrayNumber") val arrayNumber: kotlin.Array? = null -) +) +: Serializable 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 a430c0559325..d406e97bf71f 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 @@ -14,12 +14,14 @@ package org.openapitools.client.models import org.openapitools.client.models.ReadOnlyFirst import com.squareup.moshi.Json +import java.io.Serializable /** * * @param arrayOfString * @param arrayArrayOfInteger * @param arrayArrayOfModel */ + data class ArrayTest ( @Json(name = "array_of_string") val arrayOfString: kotlin.Array? = null, @@ -27,6 +29,7 @@ data class ArrayTest ( val arrayArrayOfInteger: kotlin.Array>? = null, @Json(name = "array_array_of_model") val arrayArrayOfModel: kotlin.Array>? = null -) +) +: Serializable 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 72b27a545076..c9153d08cc24 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param smallCamel @@ -22,6 +23,7 @@ import com.squareup.moshi.Json * @param scAETHFlowPoints * @param ATT_NAME Name of the pet */ + data class Capitalization ( @Json(name = "smallCamel") val smallCamel: kotlin.String? = null, @@ -36,6 +38,7 @@ data class Capitalization ( /* Name of the pet */ @Json(name = "ATT_NAME") val ATT_NAME: kotlin.String? = null -) +) +: Serializable 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 1ce9e6ef4315..05c1647fb799 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 @@ -15,10 +15,12 @@ import org.openapitools.client.models.Animal import org.openapitools.client.models.CatAllOf import com.squareup.moshi.Json +import java.io.Serializable /** * * @param declawed */ + data class Cat ( @Json(name = "className") val className: kotlin.String, @@ -26,6 +28,7 @@ data class Cat ( val declawed: kotlin.Boolean? = null, @Json(name = "color") val color: kotlin.String? = null -) +) +: Serializable 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 ec9862cd1757..c4cb55cb62ca 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param declawed */ + data class CatAllOf ( @Json(name = "declawed") val declawed: kotlin.Boolean? = null -) +) +: Serializable 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 059231f463c0..f3280e75d4c4 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param id * @param name */ + data class Category ( @Json(name = "name") val name: kotlin.String, @Json(name = "id") val id: kotlin.Long? = null -) +) +: Serializable 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 06245c42beb4..7580a49224f8 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Model for testing model with \"_class\" property * @param propertyClass */ + data class ClassModel ( @Json(name = "_class") val propertyClass: kotlin.String? = null -) +) +: Serializable 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 4a0cc69a783c..09324d61a090 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param client */ + data class Client ( @Json(name = "client") val client: kotlin.String? = null -) +) +: Serializable 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 19cb002da7e8..54a2bb6feafa 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 @@ -15,10 +15,12 @@ import org.openapitools.client.models.Animal import org.openapitools.client.models.DogAllOf import com.squareup.moshi.Json +import java.io.Serializable /** * * @param breed */ + data class Dog ( @Json(name = "className") val className: kotlin.String, @@ -26,6 +28,7 @@ data class Dog ( val breed: kotlin.String? = null, @Json(name = "color") val color: kotlin.String? = null -) +) +: Serializable 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 71b1b71365af..6085540ff7f6 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param breed */ + data class DogAllOf ( @Json(name = "breed") val breed: kotlin.String? = null -) +) +: Serializable 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 862929784c01..79b1a4c10185 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 @@ -13,44 +13,50 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param justSymbol * @param arrayEnum */ + data class EnumArrays ( @Json(name = "just_symbol") val justSymbol: EnumArrays.JustSymbol? = null, @Json(name = "array_enum") val arrayEnum: kotlin.Array? = null -) +) +: Serializable { + /** * * Values: greaterThanEqual,dollar */ + enum class JustSymbol(val value: kotlin.String){ @Json(name = ">=") greaterThanEqual(">="), @Json(name = "$") dollar("$"); + } -} -{ /** * * Values: fish,crab */ + enum class ArrayEnum(val value: kotlin.String){ @Json(name = "fish") fish("fish"), @Json(name = "crab") crab("crab"); + } -} +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt index c1d5645936e5..db8cf07dd99c 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt @@ -18,6 +18,7 @@ import com.squareup.moshi.Json * * Values: abc,minusEfg,leftParenthesisXyzRightParenthesis */ + enum class EnumClass(val value: kotlin.String){ @@ -33,5 +34,6 @@ enum class EnumClass(val value: kotlin.String){ leftParenthesisXyzRightParenthesis("(xyz)"); + } 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 5c4073650378..52ea113cc925 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 @@ -17,6 +17,7 @@ import org.openapitools.client.models.OuterEnumInteger import org.openapitools.client.models.OuterEnumIntegerDefaultValue import com.squareup.moshi.Json +import java.io.Serializable /** * * @param enumString @@ -28,6 +29,7 @@ import com.squareup.moshi.Json * @param outerEnumDefaultValue * @param outerEnumIntegerDefaultValue */ + data class EnumTest ( @Json(name = "enum_string_required") val enumStringRequired: EnumTest.EnumStringRequired, @@ -45,13 +47,16 @@ data class EnumTest ( val outerEnumDefaultValue: OuterEnumDefaultValue? = null, @Json(name = "outerEnumIntegerDefaultValue") val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = null -) +) +: Serializable { + /** * * Values: uPPER,lower,eMPTY */ + enum class EnumString(val value: kotlin.String){ @Json(name = "UPPER") uPPER("UPPER"), @@ -60,14 +65,14 @@ data class EnumTest ( @Json(name = "") eMPTY(""); + } -} -{ /** * * Values: uPPER,lower,eMPTY */ + enum class EnumStringRequired(val value: kotlin.String){ @Json(name = "UPPER") uPPER("UPPER"), @@ -76,35 +81,36 @@ data class EnumTest ( @Json(name = "") eMPTY(""); + } -} -{ /** * * Values: _1,minus1 */ + enum class EnumInteger(val value: kotlin.Int){ @Json(name = 1) _1(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.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 82e56661014b..ab39639e0ccd 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param file * @param files */ + data class FileSchemaTestClass ( @Json(name = "file") val file: java.io.File? = null, @Json(name = "files") val files: kotlin.Array? = null -) +) +: Serializable 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 4ac59867244b..0dd32c21afb7 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param bar */ + data class Foo ( @Json(name = "bar") val bar: kotlin.String? = null -) +) +: Serializable 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 d185226b0dc0..e746da485f97 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param integer @@ -31,6 +32,7 @@ import com.squareup.moshi.Json * @param patternWithDigits A string that is a 10 digit number. Can have leading zeros. * @param patternWithDigitsAndDelimiter A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */ + data class FormatTest ( @Json(name = "number") val number: java.math.BigDecimal, @@ -64,6 +66,7 @@ data class FormatTest ( /* 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 -) +) +: Serializable 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 1e649d71f249..04eef4d206b1 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param bar * @param foo */ + data class HasOnlyReadOnly ( @Json(name = "bar") val bar: kotlin.String? = null, @Json(name = "foo") val foo: kotlin.String? = null -) +) +: Serializable 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 8f53541bd227..ce497df1fca4 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. * @param nullableMessage */ + data class HealthCheckResult ( @Json(name = "NullableMessage") val nullableMessage: kotlin.String? = null -) +) +: Serializable 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 70484e689460..f2f290f4081f 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 @@ -13,11 +13,13 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param name Updated name of the pet * @param status Updated status of the pet */ + data class InlineObject ( /* Updated name of the pet */ @Json(name = "name") @@ -25,6 +27,7 @@ data class InlineObject ( /* Updated status of the pet */ @Json(name = "status") val status: kotlin.String? = null -) +) +: Serializable 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 51f2137de920..ea1e3ae2411f 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 @@ -13,11 +13,13 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param additionalMetadata Additional data to pass to server * @param file file to upload */ + data class InlineObject1 ( /* Additional data to pass to server */ @Json(name = "additionalMetadata") @@ -25,6 +27,7 @@ data class InlineObject1 ( /* file to upload */ @Json(name = "file") val file: java.io.File? = null -) +) +: Serializable 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 0f982f05a809..ec48e39edf21 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 @@ -13,11 +13,13 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param enumFormStringArray Form parameter enum test (string array) * @param enumFormString Form parameter enum test (string) */ + data class InlineObject2 ( /* Form parameter enum test (string array) */ @Json(name = "enum_form_string_array") @@ -25,27 +27,30 @@ data class InlineObject2 ( /* Form parameter enum test (string) */ @Json(name = "enum_form_string") val enumFormString: InlineObject2.EnumFormString? = null -) +) +: Serializable { + /** * Form parameter enum test (string array) * Values: greaterThan,dollar */ + enum class EnumFormStringArray(val value: kotlin.String){ @Json(name = ">") greaterThan(">"), @Json(name = "$") dollar("$"); + } -} -{ /** * Form parameter enum test (string) * Values: abc,minusEfg,leftParenthesisXyzRightParenthesis */ + enum class EnumFormString(val value: kotlin.String){ @Json(name = "_abc") abc("_abc"), @@ -54,7 +59,8 @@ data class InlineObject2 ( @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 35dc49df571f..b2725c7fc127 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param integer None @@ -30,6 +31,7 @@ import com.squareup.moshi.Json * @param password None * @param callback None */ + data class InlineObject3 ( /* None */ @Json(name = "number") @@ -73,6 +75,7 @@ data class InlineObject3 ( /* None */ @Json(name = "callback") val callback: kotlin.String? = null -) +) +: Serializable 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 52eef17034ac..f6776d3b7fcb 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 @@ -13,11 +13,13 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param param field1 * @param param2 field2 */ + data class InlineObject4 ( /* field1 */ @Json(name = "param") @@ -25,6 +27,7 @@ data class InlineObject4 ( /* field2 */ @Json(name = "param2") val param2: kotlin.String -) +) +: Serializable 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 ca95c5ee037e..0497fa03e67b 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 @@ -13,11 +13,13 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param additionalMetadata Additional data to pass to server * @param requiredFile file to upload */ + data class InlineObject5 ( /* file to upload */ @Json(name = "requiredFile") @@ -25,6 +27,7 @@ data class InlineObject5 ( /* Additional data to pass to server */ @Json(name = "additionalMetadata") val additionalMetadata: kotlin.String? = null -) +) +: Serializable 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 5768639b0b22..b09c724605e0 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 @@ -14,13 +14,16 @@ package org.openapitools.client.models import org.openapitools.client.models.Foo import com.squareup.moshi.Json +import java.io.Serializable /** * * @param string */ + data class InlineResponseDefault ( @Json(name = "string") val string: Foo? = null -) +) +: Serializable 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 6e2a75355bdc..43f321eabcbf 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * - * @param `123minusList` + * @param ``123minusList`` */ + data class List ( @Json(name = "123-list") - val `123minusList`: kotlin.String? = null -) + val ``123minusList``: kotlin.String? = null +) +: Serializable 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 dc1096dc70b1..bf1aa56a1582 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param mapMapOfString @@ -20,6 +21,7 @@ import com.squareup.moshi.Json * @param directMap * @param indirectMap */ + data class MapTest ( @Json(name = "map_map_of_string") val mapMapOfString: kotlin.collections.Map>? = null, @@ -29,20 +31,24 @@ data class MapTest ( val directMap: kotlin.collections.Map? = null, @Json(name = "indirect_map") val indirectMap: kotlin.collections.Map? = null -) +) +: Serializable { + /** * * Values: uPPER,lower */ + enum class MapOfEnumString(val value: kotlin.collections.Map){ @Json(name = "UPPER") uPPER("UPPER"), @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 7d835a2af541..1551efc4c2a0 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 @@ -14,12 +14,14 @@ package org.openapitools.client.models import org.openapitools.client.models.Animal import com.squareup.moshi.Json +import java.io.Serializable /** * * @param uuid * @param dateTime * @param map */ + data class MixedPropertiesAndAdditionalPropertiesClass ( @Json(name = "uuid") val uuid: java.util.UUID? = null, @@ -27,6 +29,7 @@ data class MixedPropertiesAndAdditionalPropertiesClass ( val dateTime: java.time.LocalDateTime? = null, @Json(name = "map") val map: kotlin.collections.Map? = null -) +) +: Serializable 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 b2e792c8e8e8..bb071875225b 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Model for testing model name starting with number * @param name * @param propertyClass */ + data class Model200Response ( @Json(name = "name") val name: kotlin.Int? = null, @Json(name = "class") val propertyClass: kotlin.String? = null -) +) +: Serializable 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 72cb9d7ad64b..1362bd97c1b7 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 @@ -13,13 +13,15 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Model for testing model name same as property name * @param name * @param snakeCase * @param property - * @param `123number` + * @param ``123number`` */ + data class Name ( @Json(name = "name") val name: kotlin.Int, @@ -28,7 +30,8 @@ data class Name ( @Json(name = "property") val property: kotlin.String? = null, @Json(name = "123Number") - val `123number`: kotlin.Int? = null -) + val ``123number``: kotlin.Int? = null +) +: Serializable 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 86bb11c5c1d9..7bfd1d97c1a2 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param integerProp @@ -28,6 +29,7 @@ import com.squareup.moshi.Json * @param objectAndItemsNullableProp * @param objectItemsNullable */ + data class NullableClass ( @Json(name = "integer_prop") val integerProp: kotlin.Int? = null, @@ -53,6 +55,7 @@ data class NullableClass ( val objectAndItemsNullableProp: kotlin.collections.Map? = null, @Json(name = "object_items_nullable") val objectItemsNullable: kotlin.collections.Map? = null -) +) +: Serializable 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 7385bd952314..d14ad1907e18 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param justNumber */ + data class NumberOnly ( @Json(name = "JustNumber") val justNumber: java.math.BigDecimal? = null -) +) +: Serializable 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 d33f3bf23935..07459585e998 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param id @@ -22,6 +23,7 @@ import com.squareup.moshi.Json * @param status Order Status * @param complete */ + data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @@ -36,13 +38,16 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) +) +: Serializable { + /** * Order Status * Values: placed,approved,delivered */ + enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @@ -51,7 +56,8 @@ data class Order ( @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 304f88c52df4..21565c2cff39 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 @@ -13,12 +13,14 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param myNumber * @param myString * @param myBoolean */ + data class OuterComposite ( @Json(name = "my_number") val myNumber: java.math.BigDecimal? = null, @@ -26,6 +28,7 @@ data class OuterComposite ( val myString: kotlin.String? = null, @Json(name = "my_boolean") val myBoolean: kotlin.Boolean? = null -) +) +: Serializable diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt index 8d84d2718738..86ce0b25a147 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt @@ -18,6 +18,7 @@ import com.squareup.moshi.Json * * Values: placed,approved,delivered */ + enum class OuterEnum(val value: kotlin.String){ @@ -33,5 +34,6 @@ enum class OuterEnum(val value: kotlin.String){ delivered("delivered"); + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt index b3fa7c452428..bf9e3e79960e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt @@ -18,6 +18,7 @@ import com.squareup.moshi.Json * * Values: placed,approved,delivered */ + enum class OuterEnumDefaultValue(val value: kotlin.String){ @@ -33,5 +34,6 @@ enum class OuterEnumDefaultValue(val value: kotlin.String){ delivered("delivered"); + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt index 9defa9842e48..c7345e41ebe2 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt @@ -18,6 +18,7 @@ import com.squareup.moshi.Json * * Values: _0,_1,_2 */ + enum class OuterEnumInteger(val value: kotlin.Int){ @@ -33,5 +34,6 @@ enum class OuterEnumInteger(val value: kotlin.Int){ _2(2); + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt index 8b9a7e71846e..f8435385ea38 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt @@ -18,6 +18,7 @@ import com.squareup.moshi.Json * * Values: _0,_1,_2 */ + enum class OuterEnumIntegerDefaultValue(val value: kotlin.Int){ @@ -33,5 +34,6 @@ enum class OuterEnumIntegerDefaultValue(val value: kotlin.Int){ _2(2); + } 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 b0c73cfb5144..23abc63ce399 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 @@ -15,6 +15,7 @@ import org.openapitools.client.models.Category import org.openapitools.client.models.Tag import com.squareup.moshi.Json +import java.io.Serializable /** * * @param id @@ -24,6 +25,7 @@ import com.squareup.moshi.Json * @param tags * @param status pet status in the store */ + data class Pet ( @Json(name = "name") val name: kotlin.String, @@ -38,13 +40,16 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) +) +: Serializable { + /** * pet status in the store * Values: available,pending,sold */ + enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @@ -53,7 +58,8 @@ data class Pet ( @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 52bf083649ae..325a4c5ffd8f 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param bar * @param baz */ + data class ReadOnlyFirst ( @Json(name = "bar") val bar: kotlin.String? = null, @Json(name = "baz") val baz: kotlin.String? = null -) +) +: Serializable 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 91c531468436..6670a26a8f96 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * Model for testing reserved words - * @param `return` + * @param ``return`` */ + data class Return ( @Json(name = "return") - val `return`: kotlin.Int? = null -) + val ``return``: kotlin.Int? = null +) +: Serializable 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 a4faf3fd57a5..2bcfeb506eb3 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 @@ -13,13 +13,16 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket */ + data class SpecialModelname ( @Json(name = "$special[property.name]") val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null -) +) +: Serializable 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 37e9e0eaef3d..7596c7d495d5 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 @@ -13,16 +13,19 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param id * @param name */ + data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) +) +: Serializable 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 5301e72d3763..d6bd140f13aa 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 @@ -13,6 +13,7 @@ package org.openapitools.client.models import com.squareup.moshi.Json +import java.io.Serializable /** * * @param id @@ -24,6 +25,7 @@ import com.squareup.moshi.Json * @param phone * @param userStatus User Status */ + data class User ( @Json(name = "id") val id: kotlin.Long? = null, @@ -42,6 +44,7 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) +) +: Serializable diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt index d61abe165a06..5ced7087da8a 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt @@ -12,6 +12,7 @@ package org.openapitools.server.models +import java.io.Serializable /** * Describes the result of uploading an image resource * @param code @@ -22,7 +23,10 @@ data class ApiResponse ( val code: kotlin.Int? = null, val type: kotlin.String? = null, val message: kotlin.String? = null -) { +) +: Serializable + +{ } diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Category.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Category.kt index 5b6aab934e25..a347a27877f1 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Category.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Category.kt @@ -12,6 +12,7 @@ package org.openapitools.server.models +import java.io.Serializable /** * A category for a pet * @param id @@ -20,7 +21,10 @@ package org.openapitools.server.models data class Category ( val id: kotlin.Long? = null, val name: kotlin.String? = null -) { +) +: Serializable + +{ } diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt index 119722f85c19..f3eba3816ed4 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt @@ -12,6 +12,7 @@ package org.openapitools.server.models +import java.io.Serializable /** * An order for a pets from the pet store * @param id @@ -29,7 +30,10 @@ data class Order ( /* Order Status */ val status: Order.Status? = null, val complete: kotlin.Boolean? = null -) { +) +: Serializable + +{ /** * Order Status diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Pet.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Pet.kt index a21ea8ed37ed..07644fc8bd26 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Pet.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Pet.kt @@ -14,6 +14,7 @@ package org.openapitools.server.models import org.openapitools.server.models.Category import org.openapitools.server.models.Tag +import java.io.Serializable /** * A pet for sale in the pet store * @param id @@ -31,7 +32,10 @@ data class Pet ( val tags: kotlin.Array? = null, /* pet status in the store */ val status: Pet.Status? = null -) { +) +: Serializable + +{ /** * pet status in the store diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Tag.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Tag.kt index eadd8e74d398..aa13b7ca76cb 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Tag.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Tag.kt @@ -12,6 +12,7 @@ package org.openapitools.server.models +import java.io.Serializable /** * A tag for a pet * @param id @@ -20,7 +21,10 @@ package org.openapitools.server.models data class Tag ( val id: kotlin.Long? = null, val name: kotlin.String? = null -) { +) +: Serializable + +{ } diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/User.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/User.kt index bf6e8f53ecc5..0aa8a67299f5 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/User.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/User.kt @@ -12,6 +12,7 @@ package org.openapitools.server.models +import java.io.Serializable /** * A User who is purchasing from the pet store * @param id @@ -33,7 +34,10 @@ data class User ( val phone: kotlin.String? = null, /* User Status */ val userStatus: kotlin.Int? = null -) { +) +: Serializable + +{ }