diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiClient.kt.mustache
index 3bb9f079ac0..e57a0addfd4 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiClient.kt.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiClient.kt.mustache
@@ -82,20 +82,22 @@ open class ApiClient(val baseUrl: String) {
{{#isKeyInQuery}}
if (requestConfig.query["{{keyParamName}}"].isNullOrEmpty()) {
{{/isKeyInQuery}}
- if (apiKeyPrefix["{{keyParamName}}"] != null) {
- {{#isKeyInHeader}}
- requestConfig.headers["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"] + " " + apiKey["{{keyParamName}}"]
- {{/isKeyInHeader}}
- {{#isKeyInQuery}}
- requestConfig.query["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"] + " " + apiKey["{{keyParamName}}"]
- {{/isKeyInQuery}}
- } else {
- {{#isKeyInHeader}}
- requestConfig.headers["{{keyParamName}}"] = apiKey["{{keyParamName}}"]
- {{/isKeyInHeader}}
- {{#isKeyInQuery}}
- requestConfig.query["{{keyParamName}}"] = apiKey["{{keyParamName}}"]
- {{/isKeyInQuery}}
+ if (apiKey["{{keyParamName}}"] != null) {
+ if (apiKeyPrefix["{{keyParamName}}"] != null) {
+ {{#isKeyInHeader}}
+ requestConfig.headers["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!
+ {{/isKeyInHeader}}
+ {{#isKeyInQuery}}
+ requestConfig.query["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!
+ {{/isKeyInQuery}}
+ } else {
+ {{#isKeyInHeader}}
+ requestConfig.headers["{{keyParamName}}"] = apiKey["{{keyParamName}}"]!!
+ {{/isKeyInHeader}}
+ {{#isKeyInQuery}}
+ requestConfig.query["{{keyParamName}}"] = apiKey["{{keyParamName}}"]!!
+ {{/isKeyInQuery}}
+ }
}
}
{{/isApiKey}}
diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
index e6ebe7982db..def00253aed 100644
--- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
+++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
@@ -74,10 +74,12 @@ open class ApiClient(val baseUrl: String) {
protected fun updateAuthParams(requestConfig: RequestConfig) {
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
- if (apiKeyPrefix["api_key"] != null) {
- requestConfig.headers["api_key"] = apiKeyPrefix["api_key"] + " " + apiKey["api_key"]
- } else {
- requestConfig.headers["api_key"] = apiKey["api_key"]
+ if (apiKey["api_key"] != null) {
+ if (apiKeyPrefix["api_key"] != null) {
+ requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+ } else {
+ requestConfig.headers["api_key"] = apiKey["api_key"]!!
+ }
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
diff --git a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION
index 83a328a9227..2f81801b794 100644
--- a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION
+++ b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION
@@ -1 +1 @@
-4.1.0-SNAPSHOT
\ No newline at end of file
+4.1.1-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md
index 7ffab3ed071..afacd58744b 100644
--- a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md
+++ b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md
@@ -17,6 +17,7 @@ Method | HTTP request | Description
[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
+[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters |
@@ -670,3 +671,57 @@ No authorization required
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
+
+# **testQueryParameterCollectionFormat**
+> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context)
+
+
+
+To test the collection format in query parameters
+
+### Example
+```kotlin
+// Import classes:
+//import org.openapitools.client.infrastructure.*
+//import org.openapitools.client.models.*
+
+val apiInstance = FakeApi()
+val pipe : kotlin.Array = // kotlin.Array |
+val ioutil : kotlin.Array = // kotlin.Array |
+val http : kotlin.Array = // kotlin.Array |
+val url : kotlin.Array = // kotlin.Array |
+val context : kotlin.Array = // kotlin.Array |
+try {
+ apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context)
+} catch (e: ClientException) {
+ println("4xx response calling FakeApi#testQueryParameterCollectionFormat")
+ e.printStackTrace()
+} catch (e: ServerException) {
+ println("5xx response calling FakeApi#testQueryParameterCollectionFormat")
+ e.printStackTrace()
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **pipe** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| |
+ **ioutil** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| |
+ **http** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| |
+ **url** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| |
+ **context** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| |
+
+### Return type
+
+null (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt
index 5079cdf61aa..ae9aed9232a 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt
@@ -51,8 +51,8 @@ class AnotherFakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as Client
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
index 73e12e59ab1..457573efef8 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
@@ -50,8 +50,8 @@ class DefaultApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") :
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as InlineResponseDefault
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt
index b493a0282e2..49c4f77616f 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt
@@ -54,8 +54,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as HealthCheckResult
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -85,8 +85,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as kotlin.Boolean
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -116,8 +116,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as OuterComposite
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -147,8 +147,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as java.math.BigDecimal
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -178,8 +178,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as kotlin.String
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -208,8 +208,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -239,8 +239,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -270,8 +270,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as Client
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -313,8 +313,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -350,8 +350,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -385,8 +385,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -415,8 +415,8 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -446,8 +446,42 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+ ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
+ ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
+ }
+ }
+
+ /**
+ *
+ * To test the collection format in query parameters
+ * @param pipe
+ * @param ioutil
+ * @param http
+ * @param url
+ * @param context
+ * @return void
+ */
+ fun testQueryParameterCollectionFormat(pipe: kotlin.Array, ioutil: kotlin.Array, http: kotlin.Array, url: kotlin.Array, context: kotlin.Array) : Unit {
+ val localVariableBody: kotlin.Any? = null
+ val localVariableQuery: MultiValueMap = mapOf("pipe" to toMultiValue(pipe.toList(), "multi"), "ioutil" to toMultiValue(ioutil.toList(), "csv"), "http" to toMultiValue(http.toList(), "space"), "url" to toMultiValue(url.toList(), "csv"), "context" to toMultiValue(context.toList(), "multi"))
+ val localVariableHeaders: MutableMap = mutableMapOf()
+ val localVariableConfig = RequestConfig(
+ RequestMethod.PUT,
+ "/fake/test-query-paramters",
+ query = localVariableQuery,
+ headers = localVariableHeaders
+ )
+ val response = request(
+ localVariableConfig,
+ localVariableBody
+ )
+
+ return when (response.responseType) {
+ ResponseType.Success -> Unit
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt
index 3d5e0162ee7..1d9dcaef220 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt
@@ -51,8 +51,8 @@ class FakeClassnameTags123Api(basePath: kotlin.String = "http://petstore.swagger
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as Client
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
index 1652bcba5d5..041c54baad8 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
@@ -51,8 +51,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -82,8 +82,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -113,8 +113,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as kotlin.Array
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -144,8 +144,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as kotlin.Array
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -175,8 +175,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as Pet
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -205,8 +205,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -237,8 +237,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -270,8 +270,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as ApiResponse
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -303,8 +303,8 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as ApiResponse
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
index 59d3822c0ba..413cfbb0728 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
@@ -50,8 +50,8 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -80,8 +80,8 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as kotlin.collections.Map
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -111,8 +111,8 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as Order
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -142,8 +142,8 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as Order
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
index 47151322588..bb4d53269c2 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
@@ -50,8 +50,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -80,8 +80,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -110,8 +110,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -140,8 +140,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -171,8 +171,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as User
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -203,8 +203,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> (response as Success<*>).data as kotlin.String
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -232,8 +232,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
@@ -263,8 +263,8 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
return when (response.responseType) {
ResponseType.Success -> Unit
- ResponseType.Informational -> TODO()
- ResponseType.Redirection -> TODO()
+ ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+ ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
index ae4ed0fbdb6..8db022446f2 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
@@ -2,10 +2,12 @@ package org.openapitools.client.infrastructure
import okhttp3.OkHttpClient
import okhttp3.RequestBody
-import okhttp3.MediaType
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.FormBody
-import okhttp3.HttpUrl
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.Request
import java.io.File
@@ -36,8 +38,8 @@ open class ApiClient(val baseUrl: String) {
protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
when {
- content is File -> RequestBody.create(
- MediaType.parse(mediaType), content
+ content is File -> content.asRequestBody(
+ mediaType.toMediaTypeOrNull()
)
mediaType == FormDataMediaType || mediaType == FormUrlEncMediaType -> {
FormBody.Builder().apply {
@@ -48,12 +50,12 @@ open class ApiClient(val baseUrl: String) {
}
}.build()
}
- mediaType == JsonMediaType -> RequestBody.create(
- MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content)
+ mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+ mediaType.toMediaTypeOrNull()
)
- mediaType == XmlMediaType -> TODO("xml not currently supported.")
+ mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
// TODO: this should be extended with other serializers
- else -> TODO("requestBody currently only supports JSON body and File body.")
+ else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
}
protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
@@ -66,23 +68,27 @@ open class ApiClient(val baseUrl: String) {
}
return when(mediaType) {
JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
- else -> TODO("responseBody currently only supports JSON body.")
+ else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.")
}
}
protected fun updateAuthParams(requestConfig: RequestConfig) {
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
- if (apiKeyPrefix["api_key"] != null) {
- requestConfig.headers["api_key"] = apiKeyPrefix["api_key"] + " " + apiKey["api_key"]
- } else {
- requestConfig.headers["api_key"] = apiKey["api_key"]
+ if (apiKey["api_key"] != null) {
+ if (apiKeyPrefix["api_key"] != null) {
+ requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+ } else {
+ requestConfig.headers["api_key"] = apiKey["api_key"]!!
+ }
}
}
if (requestConfig.query["api_key_query"].isNullOrEmpty()) {
- if (apiKeyPrefix["api_key_query"] != null) {
- requestConfig.query["api_key_query"] = apiKeyPrefix["api_key_query"] + " " + apiKey["api_key_query"]
- } else {
- requestConfig.query["api_key_query"] = apiKey["api_key_query"]
+ if (apiKey["api_key_query"] != null) {
+ if (apiKeyPrefix["api_key_query"] != null) {
+ requestConfig.query["api_key_query"] = apiKeyPrefix["api_key_query"]!! + " " + apiKey["api_key_query"]!!
+ } else {
+ requestConfig.query["api_key_query"] = apiKey["api_key_query"]!!
+ }
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
@@ -97,7 +103,7 @@ open class ApiClient(val baseUrl: String) {
}
protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse {
- val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
+ val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
updateAuthParams(requestConfig)
@@ -150,29 +156,29 @@ open class ApiClient(val baseUrl: String) {
// TODO: handle specific mapping types. e.g. Map>
when {
response.isRedirect -> return Redirection(
- response.code(),
- response.headers().toMultimap()
+ response.code,
+ response.headers.toMultimap()
)
response.isInformational -> return Informational(
- response.message(),
- response.code(),
- response.headers().toMultimap()
+ response.message,
+ response.code,
+ response.headers.toMultimap()
)
response.isSuccessful -> return Success(
- responseBody(response.body(), accept),
- response.code(),
- response.headers().toMultimap()
+ responseBody(response.body, accept),
+ response.code,
+ response.headers.toMultimap()
)
response.isClientError -> return ClientError(
- response.body()?.string(),
- response.code(),
- response.headers().toMultimap()
+ response.body?.string(),
+ response.code,
+ response.headers.toMultimap()
)
else -> return ServerError(
null,
- response.body()?.string(),
- response.code(),
- response.headers().toMultimap()
+ response.body?.string(),
+ response.code,
+ response.headers.toMultimap()
)
}
}
diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
index f50104a6f35..934962ec6b5 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -5,19 +5,19 @@ import okhttp3.Response
/**
* Provides an extension to evaluation whether the response is a 1xx code
*/
-val Response.isInformational : Boolean get() = this.code() in 100..199
+val Response.isInformational : Boolean get() = this.code in 100..199
/**
* Provides an extension to evaluation whether the response is a 3xx code
*/
-val Response.isRedirect : Boolean get() = this.code() in 300..399
+val Response.isRedirect : Boolean get() = this.code in 300..399
/**
* Provides an extension to evaluation whether the response is a 4xx code
*/
-val Response.isClientError : Boolean get() = this.code() in 400..499
+val Response.isClientError : Boolean get() = this.code in 400..499
/**
* Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
*/
-val Response.isServerError : Boolean get() = this.code() in 500..999
\ No newline at end of file
+val Response.isServerError : Boolean get() = this.code in 500..999
\ No newline at end of file
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 d791eb136eb..1908c031f15 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
@@ -22,7 +22,7 @@ data class EnumArrays (
@Json(name = "just_symbol")
val justSymbol: EnumArrays.JustSymbol? = null,
@Json(name = "array_enum")
- val arrayEnum: EnumArrays.ArrayEnum? = null
+ val arrayEnum: kotlin.Array? = null
) {
/**
@@ -43,7 +43,7 @@ data class EnumArrays (
*
* Values: fish,crab
*/
- enum class ArrayEnum(val value: kotlin.Array<kotlin.String>){
+ enum class ArrayEnum(val value: kotlin.String){
@Json(name = "fish")
fish("fish"),
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 089f8037e31..c1d5645936e 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
@@ -20,14 +20,18 @@ import com.squareup.moshi.Json
*/
enum class EnumClass(val value: kotlin.String){
+
@Json(name = "_abc")
abc("_abc"),
+
@Json(name = "-efg")
minusEfg("-efg"),
+
@Json(name = "(xyz)")
leftParenthesisXyzRightParenthesis("(xyz)");
+
}
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 989561cbeb6..bf824926150 100644
--- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt
+++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt
@@ -21,7 +21,7 @@ import com.squareup.moshi.Json
data class InlineObject2 (
/* Form parameter enum test (string array) */
@Json(name = "enum_form_string_array")
- val enumFormStringArray: InlineObject2.EnumFormStringArray? = null,
+ val enumFormStringArray: kotlin.Array? = null,
/* Form parameter enum test (string) */
@Json(name = "enum_form_string")
val enumFormString: InlineObject2.EnumFormString? = null
@@ -31,7 +31,7 @@ data class InlineObject2 (
* Form parameter enum test (string array)
* Values: greaterThan,dollar
*/
- enum class EnumFormStringArray(val value: kotlin.Array<kotlin.String>){
+ enum class EnumFormStringArray(val value: kotlin.String){
@Json(name = ">")
greaterThan(">"),
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 bde64f1b11c..8d752fbb688 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
@@ -35,7 +35,7 @@ data class MapTest (
*
* Values: uPPER,lower
*/
- enum class MapOfEnumString(val value: kotlin.collections.Map<kotlin.String, kotlin.String>){
+ enum class MapOfEnumString(val value: kotlin.collections.Map){
@Json(name = "UPPER")
uPPER("UPPER"),
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 bd3b936859f..8d84d271873 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
@@ -20,14 +20,18 @@ import com.squareup.moshi.Json
*/
enum class OuterEnum(val value: kotlin.String){
+
@Json(name = "placed")
placed("placed"),
+
@Json(name = "approved")
approved("approved"),
+
@Json(name = "delivered")
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 48a990701be..b3fa7c45242 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
@@ -20,14 +20,18 @@ import com.squareup.moshi.Json
*/
enum class OuterEnumDefaultValue(val value: kotlin.String){
+
@Json(name = "placed")
placed("placed"),
+
@Json(name = "approved")
approved("approved"),
+
@Json(name = "delivered")
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 cbaa42709a8..9defa9842e4 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
@@ -20,14 +20,18 @@ import com.squareup.moshi.Json
*/
enum class OuterEnumInteger(val value: kotlin.Int){
+
@Json(name = "0")
_0(0),
+
@Json(name = "1")
_1(1),
+
@Json(name = "2")
_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 348b303d6cd..8b9a7e71846 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
@@ -20,14 +20,18 @@ import com.squareup.moshi.Json
*/
enum class OuterEnumIntegerDefaultValue(val value: kotlin.Int){
+
@Json(name = "0")
_0(0),
+
@Json(name = "1")
_1(1),
+
@Json(name = "2")
_2(2);
+
}