forked from loafle/openapi-generator-original
Kotlin: Fix kotlinx_serialization code generation (#9576)
And update to Kotlin 1.5.0 and kotlinx.serialization 1.2.1. Fix nested enum annotation '@Serializable' instead of '@KSerializable' when 'kotlinx_serialization' is used. Fix missing JsonMediaType in ApiClient.kt (#9242). Add 'kotlinx_serialization' serialization library to documentation. Use explicity type in RequestConfig to keep type information for JSON serialization. Resolves #9242
This commit is contained in:
@@ -155,7 +155,7 @@ open class ApiClient(
|
||||
else request(requestConfig, authNames = authNames)
|
||||
}
|
||||
|
||||
protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||
protected suspend inline fun <reified T: Any?> request(requestConfig: RequestConfig<T>, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||
requestConfig.updateForAuth(authNames)
|
||||
val headers = requestConfig.headers
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||
* multi-valued headers as csv-only.
|
||||
*/
|
||||
data class RequestConfig(
|
||||
data class RequestConfig<T>(
|
||||
val method: RequestMethod,
|
||||
val path: String,
|
||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||
val query: MutableMap<String, List<String>> = mutableMapOf(),
|
||||
val body: kotlin.Any? = null
|
||||
val body: T? = null
|
||||
)
|
||||
Reference in New Issue
Block a user