[Kotlin] Introduce support for Kotlin Explicit API Mode for Kotlin-Client generator (resolve #16506) (#19999)

* [Kotlin] Properly document nonPublicApi CLI option

* [Kotlin] Respect parameter name of parent KSerializer to avoid miss-behavior

* [Kotlin] Introduce support for Kotlin Explicit API Mode for Kotlin-Client generator (resolves #16506)
This commit is contained in:
Pavel Sveda
2024-10-30 22:57:47 +01:00
committed by GitHub
parent e9ea12f25a
commit acb16410c4
271 changed files with 5524 additions and 721 deletions

View File

@@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure
typealias MultiValueMap = MutableMap<String,List<String>>
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
fun collectionDelimiter(collectionFormat: String): String = when(collectionFormat) {
"csv" -> ","
"tsv" -> "\t"
"pipe" -> "|"
@@ -12,7 +12,7 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String>
= toMultiValue(items.asIterable(), collectionFormat, map)
fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {

View File

@@ -49,8 +49,8 @@ open class ApiClient(
}
companion object {
const val BASE_URL = "http://petstore.swagger.io/v2"
protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType)
const val BASE_URL: String = "http://petstore.swagger.io/v2"
protected val UNSAFE_HEADERS: List<String> = listOf(HttpHeaders.ContentType)
}
/**