From 252f0939af3c4758d6edd86ba57af94998b862a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isabella=20de=20Andrade=20=F0=9F=90=B0?= Date: Thu, 3 Sep 2020 11:00:35 +0200 Subject: [PATCH 1/3] Fix generation of optional parameters in openhttp kotlin api template This commit adjusts the kotlin openhttp api template to: 1. Default optional parameters to null so that API consumers are no longer forced to specify a value 2. Ignore null headers when building the request rather than convert them to "null" string --- .../kotlin-client/libraries/jvm-okhttp/api.mustache | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache index ee9bf10a7641..3bf5e104b9b4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache @@ -40,7 +40,7 @@ import {{packageName}}.infrastructure.toMultiValue {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} - {{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { + {{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { val localVariableBody: kotlin.Any? = {{#hasBodyParam}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}null{{/hasFormParams}}{{#hasFormParams}}mapOf({{#formParams}}"{{{baseName}}}" to {{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/formParams}}){{/hasFormParams}}{{/hasBodyParam}} val localVariableQuery: MultiValueMap = {{^hasQueryParams}}mutableMapOf() {{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf>() @@ -64,7 +64,10 @@ import {{packageName}}.infrastructure.toMultiValue {{/queryParams}} } {{/hasQueryParams}} - val localVariableHeaders: MutableMap = mutableMapOf({{#hasFormParams}}"Content-Type" to {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{/hasFormParams}}{{^hasHeaderParams}}){{/hasHeaderParams}}{{#hasHeaderParams}}{{#hasFormParams}}, {{/hasFormParams}}{{#headerParams}}"{{baseName}}" to {{#isContainer}}{{{paramName}}}.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}{{{paramName}}}.toString(){{/isContainer}}{{#hasMore}}, {{/hasMore}}{{/headerParams}}){{/hasHeaderParams}} + val localVariableHeaders: MutableMap = mutableMapOf({{#hasFormParams}}"Content-Type" to {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{/hasFormParams}}) + {{#headerParams}} + {{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{/headerParams}} val localVariableConfig = RequestConfig( RequestMethod.{{httpMethod}}, "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", "${{{paramName}}}"){{/pathParams}}, From 19b71dc2171fbe89d7f6725e0726410282998fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isabella=20de=20Andrade=20=F0=9F=90=B0?= Date: Thu, 3 Sep 2020 15:22:22 +0200 Subject: [PATCH 2/3] Update generated petstore API with template updates --- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 11 ++++++----- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 9 +++++---- 11 files changed, 56 insertions(+), 45 deletions(-) diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..bc6ba757c658 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..bc6ba757c658 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 584c6ef06867..edcdc92dbfb2 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -171,7 +172,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List { + fun getAllPets(lastUpdated: java.time.OffsetDateTime? = null) : kotlin.collections.List { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { @@ -299,7 +300,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -342,7 +343,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 1cff24913d64..11fcf9d77f3d 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..bc6ba757c658 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 5e930e963956..3c79372af8de 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 4b9faa2a2c46..2ef7ab7a1145 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse? { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..bc6ba757c658 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c95dd04f915e..a40f9679535e 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit { + fun deletePet(apiKey: kotlin.String? = null, petId: kotlin.Long) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..bc6ba757c658 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..bc6ba757c658 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,10 +85,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -297,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -340,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") From b2877e81724784b4b8c99d1e967ae79403290901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isabella=20de=20Andrade=20=F0=9F=90=B0?= Date: Fri, 4 Sep 2020 13:16:54 +0200 Subject: [PATCH 3/3] Remove null-defaulting behavior --- .../kotlin-client/libraries/jvm-okhttp/api.mustache | 2 +- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 8 ++++---- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../main/kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache index 3bf5e104b9b4..0bcf5c9ba844 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache @@ -40,7 +40,7 @@ import {{packageName}}.infrastructure.toMultiValue {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} - {{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { + {{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { val localVariableBody: kotlin.Any? = {{#hasBodyParam}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}null{{/hasFormParams}}{{#hasFormParams}}mapOf({{#formParams}}"{{{baseName}}}" to {{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/formParams}}){{/hasFormParams}}{{/hasBodyParam}} val localVariableQuery: MultiValueMap = {{^hasQueryParams}}mutableMapOf() {{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf>() diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc6ba757c658..e4f7f4eeae0f 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc6ba757c658..e4f7f4eeae0f 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index edcdc92dbfb2..6685f0a73d40 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -172,7 +172,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAllPets(lastUpdated: java.time.OffsetDateTime? = null) : kotlin.collections.List { + fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { @@ -300,7 +300,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -343,7 +343,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 11fcf9d77f3d..1ca2057e217e 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc6ba757c658..e4f7f4eeae0f 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 3c79372af8de..69cb6b35ef2a 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 2ef7ab7a1145..ef80c520fd27 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse? { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc6ba757c658..e4f7f4eeae0f 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a40f9679535e..da9784198d1c 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(apiKey: kotlin.String? = null, petId: kotlin.Long) : Unit { + fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc6ba757c658..e4f7f4eeae0f 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc6ba757c658..e4f7f4eeae0f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -85,7 +85,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -298,7 +298,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @throws ServerException If the API returns a server error response */ @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") @@ -341,7 +341,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data")