Fix #13369: kotlin-client with okhttp doesn't escape path parameters with slashes correctly (#13370)

* Fix #13369

* Regenarate samples

* Fix support for okhttp3
This commit is contained in:
Segev Finer 2022-09-09 11:31:31 +03:00 committed by GitHub
parent 0b6604504c
commit 9753086bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
66 changed files with 315 additions and 135 deletions

View File

@ -3,6 +3,7 @@ package {{apiPackage}}
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
{{#imports}}import {{import}} {{#imports}}import {{import}}
{{/imports}} {{/imports}}
@ -224,7 +225,7 @@ import {{packageName}}.infrastructure.toMultiValue
return RequestConfig( return RequestConfig(
method = RequestMethod.{{httpMethod}}, method = RequestMethod.{{httpMethod}},
path = "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}.toString(){{/isContainer}}){{/pathParams}}, path = "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}},
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -232,5 +233,8 @@ import {{packageName}}.infrastructure.toMultiValue
} }
{{/operation}} {{/operation}}
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments{{#jvm-okhttp3}}(){{/jvm-okhttp3}}[0]
} }
{{/operations}} {{/operations}}

View File

@ -313,7 +313,7 @@ import com.squareup.moshi.adapter
{{/hasAuthMethods}} {{/hasAuthMethods}}
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Bird import org.openapitools.client.models.Bird
@ -112,11 +113,14 @@ class BirdApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/v1/bird/{id}".replace("{"+"id"+"}", id.toString()), path = "/v1/bird/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import com.squareup.moshi.Json import com.squareup.moshi.Json
@ -108,11 +109,14 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/{ids}".replace("{"+"ids"+"}", ids.joinToString(",")), path = "/{ids}".replace("{"+"ids"+"}", encodeURIComponent(ids.joinToString(","))),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments()[0]
} }

View File

@ -143,7 +143,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import com.squareup.moshi.Json import com.squareup.moshi.Json
@ -108,11 +109,14 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/{ids}".replace("{"+"ids"+"}", ids.joinToString(",")), path = "/{ids}".replace("{"+"ids"+"}", encodeURIComponent(ids.joinToString(","))),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Apa import org.openapitools.client.models.Apa
@ -117,4 +118,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import com.squareup.moshi.Json import com.squareup.moshi.Json
@ -227,11 +228,14 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/test".replace("{"+"pi0"+"}", pi0.toString()).replace("{"+"pi1"+"}", pi1.toString()).replace("{"+"pn0"+"}", pn0.toString()).replace("{"+"pn1"+"}", pn1.toString()), path = "/test".replace("{"+"pi0"+"}", encodeURIComponent(pi0.toString())).replace("{"+"pi1"+"}", encodeURIComponent(pi1.toString())).replace("{"+"pn0"+"}", encodeURIComponent(pn0.toString())).replace("{"+"pn1"+"}", encodeURIComponent(pn1.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments()[0]
} }

View File

@ -143,7 +143,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import com.squareup.moshi.Json import com.squareup.moshi.Json
@ -227,11 +228,14 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/test".replace("{"+"pi0"+"}", pi0.toString()).replace("{"+"pi1"+"}", pi1.toString()).replace("{"+"pn0"+"}", pn0.toString()).replace("{"+"pn1"+"}", pn1.toString()), path = "/test".replace("{"+"pi0"+"}", encodeURIComponent(pi0.toString())).replace("{"+"pi1"+"}", encodeURIComponent(pi1.toString())).replace("{"+"pn0"+"}", encodeURIComponent(pn0.toString())).replace("{"+"pn1"+"}", encodeURIComponent(pn1.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelWithEnumPropertyHavingDefault import org.openapitools.client.models.ModelWithEnumPropertyHavingDefault
@ -116,4 +117,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -163,7 +163,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -163,7 +163,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -183,7 +184,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -406,7 +407,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -549,7 +550,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -627,11 +628,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -110,7 +111,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -247,7 +248,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -324,4 +325,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -311,7 +312,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -381,7 +382,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -592,11 +593,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -169,7 +169,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -184,7 +185,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -414,7 +415,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -557,7 +558,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -635,11 +636,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -111,7 +112,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -248,7 +249,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -325,4 +326,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -312,7 +313,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -382,7 +383,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -593,11 +594,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -166,7 +166,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpC
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpC
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpC
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpC
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHtt
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHtt
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHtt
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttp
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttp
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttp
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ internal open class ApiClient(val baseUrl: String, val client: OkHttpClient = de
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments()[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments()[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments()[0]
} }

View File

@ -162,7 +162,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.PetEnum import org.openapitools.client.models.PetEnum
@ -117,4 +118,7 @@ class EnumApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
@ -182,7 +183,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -412,7 +413,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -555,7 +556,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -633,11 +634,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
return RequestConfig( return RequestConfig(
method = RequestMethod.POST, method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", petId.toString()), path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.Order import org.openapitools.client.models.Order
@ -109,7 +110,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -246,7 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", orderId.toString()), path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -323,4 +324,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -22,6 +22,7 @@ package org.openapitools.client.apis
import java.io.IOException import java.io.IOException
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.HttpUrl
import org.openapitools.client.models.User import org.openapitools.client.models.User
@ -310,7 +311,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.DELETE, method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -380,7 +381,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.GET, method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
@ -591,11 +592,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
return RequestConfig( return RequestConfig(
method = RequestMethod.PUT, method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", username.toString()), path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery, query = localVariableQuery,
headers = localVariableHeaders, headers = localVariableHeaders,
body = localVariableBody body = localVariableBody
) )
} }
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
} }

View File

@ -164,7 +164,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
updateAuthParams(requestConfig) updateAuthParams(requestConfig)
val url = httpUrl.newBuilder() val url = httpUrl.newBuilder()
.addPathSegments(requestConfig.path.trimStart('/')) .addEncodedPathSegments(requestConfig.path.trimStart('/'))
.apply { .apply {
requestConfig.query.forEach { query -> requestConfig.query.forEach { query ->
query.value.forEach { queryValue -> query.value.forEach { queryValue ->