From 72b32fad106002b3a08e89cd0d2d63d0e8de64bc Mon Sep 17 00:00:00 2001 From: Csaba Kozak Date: Fri, 24 Nov 2023 17:43:16 +0100 Subject: [PATCH] [kotlin-client][multiplatform] update dependency versions --- .../multiplatform/build.gradle.kts.mustache | 40 +++++++------------ .../Base64ByteArray.kt.mustache | 3 +- .../infrastructure/Bytes.kt.mustache | 1 + .../infrastructure/OctetByteArray.kt.mustache | 3 +- .../serial_wrapper_request_list.mustache | 3 +- .../serial_wrapper_request_map.mustache | 3 +- .../serial_wrapper_response_list.mustache | 3 +- .../serial_wrapper_response_map.mustache | 3 +- .../build.gradle.kts | 40 +++++++------------ .../client/infrastructure/Base64ByteArray.kt | 3 +- .../client/infrastructure/Bytes.kt | 1 + .../client/infrastructure/OctetByteArray.kt | 3 +- .../build.gradle.kts | 40 +++++++------------ .../client/infrastructure/Base64ByteArray.kt | 3 +- .../client/infrastructure/Bytes.kt | 1 + .../client/infrastructure/OctetByteArray.kt | 3 +- .../build.gradle.kts | 40 +++++++------------ .../client/infrastructure/Base64ByteArray.kt | 3 +- .../client/infrastructure/Bytes.kt | 1 + .../client/infrastructure/OctetByteArray.kt | 3 +- .../build.gradle.kts | 40 +++++++------------ .../org/openapitools/client/apis/PetApi.kt | 6 +-- .../org/openapitools/client/apis/StoreApi.kt | 3 +- .../org/openapitools/client/apis/UserApi.kt | 6 +-- .../client/infrastructure/Base64ByteArray.kt | 3 +- .../client/infrastructure/Bytes.kt | 1 + .../client/infrastructure/OctetByteArray.kt | 3 +- .../kotlin-multiplatform/build.gradle.kts | 40 +++++++------------ .../org/openapitools/client/apis/PetApi.kt | 6 +-- .../org/openapitools/client/apis/StoreApi.kt | 3 +- .../org/openapitools/client/apis/UserApi.kt | 6 +-- .../client/infrastructure/Base64ByteArray.kt | 3 +- .../client/infrastructure/Bytes.kt | 1 + .../client/infrastructure/OctetByteArray.kt | 3 +- 34 files changed, 122 insertions(+), 202 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache index f99114692a07..d3f6057bc646 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache @@ -1,17 +1,17 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform"){{^omitGradlePluginVersions}} version "1.7.21" // kotlin_version{{/omitGradlePluginVersions}} - kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "1.7.21" // kotlin_version{{/omitGradlePluginVersions}} + kotlin("multiplatform"){{^omitGradlePluginVersions}} version "1.9.20" // kotlin_version{{/omitGradlePluginVersions}} + kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "1.9.20" // kotlin_version{{/omitGradlePluginVersions}} } group = "{{groupId}}" version = "{{artifactVersion}}" -val kotlin_version = "1.7.21" -val coroutines_version = "1.6.4" -val serialization_version = "1.3.3" -val ktor_version = "2.2.3" +val kotlin_version = "1.9.20" +val coroutines_version = "1.7.3" +val serialization_version = "1.6.1" +val ktor_version = "2.3.6" repositories { mavenCentral() @@ -19,15 +19,16 @@ repositories { kotlin { jvm() - ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } - iosSimulatorArm64 { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } + iosX64() + iosArm64() + iosSimulatorArm64() js { browser() nodejs() } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") @@ -38,54 +39,43 @@ kotlin { api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") {{#kotlinx-datetime}} - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") + api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") {{/kotlinx-datetime}} } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation("io.ktor:ktor-client-mock:$ktor_version") } } - val jvmMain by getting { + jvmMain { dependencies { implementation(kotlin("stdlib-jdk7")) implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit")) } } - val iosMain by getting { + iosMain { dependencies { api("io.ktor:ktor-client-ios:$ktor_version") } } - val iosTest by getting - - val iosSimulatorArm64Main by getting - - val iosSimulatorArm64Test by getting - - iosSimulatorArm64Main.dependsOn(iosMain) - iosSimulatorArm64Test.dependsOn(iosTest) - val jsMain by getting { dependencies { api("io.ktor:ktor-client-js:$ktor_version") } } - val jsTest by getting - all { languageSettings.apply { optIn("kotlin.Experimental") diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache index 59b8baf4bd4c..b8bb160990ae 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(Base64ByteArray.Companion::class) class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache index 8efab6464f46..a11e0525d910 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache @@ -82,6 +82,7 @@ private fun ByteReadPacket.encodeBase64(): String = buildString { * * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt */ +@Suppress("DEPRECATION") private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { val data = ByteArray(4) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache index 2f278d20e1e0..80c85b51c723 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache index f3b0464445ec..358dfa70be50 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache @@ -1,6 +1,5 @@ - @Serializable + @Serializable({{operationIdCamelCase}}Request.Companion::class) private class {{operationIdCamelCase}}Request(val value: List<{{#bodyParam}}{{baseType}}{{/bodyParam}}>) { - @Serializer({{operationIdCamelCase}}Request::class) {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Request> { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache index a287882728db..55efd01ad655 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache @@ -1,6 +1,5 @@ - @Serializable + @Serializable({{operationIdCamelCase}}Request.Companion::class) private class {{operationIdCamelCase}}Request(val value: Map) { - @Serializer({{operationIdCamelCase}}Request::class) {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Request> { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache index 227d6a351f29..3f191db3a67b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache @@ -1,6 +1,5 @@ - @Serializable + @Serializable({{operationIdCamelCase}}Response.Companion::class) private class {{operationIdCamelCase}}Response(val value: List<{{returnBaseType}}>) { - @Serializer({{operationIdCamelCase}}Response::class) {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Response> { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache index a6bdd6c166a1..bbd342cfa1a8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache @@ -1,6 +1,5 @@ - @Serializable + @Serializable({{operationIdCamelCase}}Response.Companion::class) private class {{operationIdCamelCase}}Response(val value: Map) { - @Serializer({{operationIdCamelCase}}Response::class) {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Response> { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/build.gradle.kts b/samples/client/petstore/kotlin-array-simple-string-multiplatform/build.gradle.kts index 8482c5193fa0..37d36cad1458 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/build.gradle.kts +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/build.gradle.kts @@ -1,17 +1,17 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform") version "1.7.21" // kotlin_version - kotlin("plugin.serialization") version "1.7.21" // kotlin_version + kotlin("multiplatform") version "1.9.20" // kotlin_version + kotlin("plugin.serialization") version "1.9.20" // kotlin_version } group = "org.openapitools" version = "1.0.0" -val kotlin_version = "1.7.21" -val coroutines_version = "1.6.4" -val serialization_version = "1.3.3" -val ktor_version = "2.2.3" +val kotlin_version = "1.9.20" +val coroutines_version = "1.7.3" +val serialization_version = "1.6.1" +val ktor_version = "2.3.6" repositories { mavenCentral() @@ -19,15 +19,16 @@ repositories { kotlin { jvm() - ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } - iosSimulatorArm64 { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } + iosX64() + iosArm64() + iosSimulatorArm64() js { browser() nodejs() } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") @@ -37,53 +38,42 @@ kotlin { api("io.ktor:ktor-client-content-negotiation:$ktor_version") api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") + api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation("io.ktor:ktor-client-mock:$ktor_version") } } - val jvmMain by getting { + jvmMain { dependencies { implementation(kotlin("stdlib-jdk7")) implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit")) } } - val iosMain by getting { + iosMain { dependencies { api("io.ktor:ktor-client-ios:$ktor_version") } } - val iosTest by getting - - val iosSimulatorArm64Main by getting - - val iosSimulatorArm64Test by getting - - iosSimulatorArm64Main.dependsOn(iosMain) - iosSimulatorArm64Test.dependsOn(iosTest) - val jsMain by getting { dependencies { api("io.ktor:ktor-client-js:$ktor_version") } } - val jsTest by getting - all { languageSettings.apply { optIn("kotlin.Experimental") diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt index 5aeea0894894..b5b7054f9092 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(Base64ByteArray.Companion::class) class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt index af8caa633ccb..df72899875bd 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt @@ -82,6 +82,7 @@ private fun ByteReadPacket.encodeBase64(): String = buildString { * * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt */ +@Suppress("DEPRECATION") private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { val data = ByteArray(4) diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt index d10d7c506523..96339312ada4 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) diff --git a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/build.gradle.kts b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/build.gradle.kts index 8482c5193fa0..37d36cad1458 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/build.gradle.kts +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/build.gradle.kts @@ -1,17 +1,17 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform") version "1.7.21" // kotlin_version - kotlin("plugin.serialization") version "1.7.21" // kotlin_version + kotlin("multiplatform") version "1.9.20" // kotlin_version + kotlin("plugin.serialization") version "1.9.20" // kotlin_version } group = "org.openapitools" version = "1.0.0" -val kotlin_version = "1.7.21" -val coroutines_version = "1.6.4" -val serialization_version = "1.3.3" -val ktor_version = "2.2.3" +val kotlin_version = "1.9.20" +val coroutines_version = "1.7.3" +val serialization_version = "1.6.1" +val ktor_version = "2.3.6" repositories { mavenCentral() @@ -19,15 +19,16 @@ repositories { kotlin { jvm() - ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } - iosSimulatorArm64 { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } + iosX64() + iosArm64() + iosSimulatorArm64() js { browser() nodejs() } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") @@ -37,53 +38,42 @@ kotlin { api("io.ktor:ktor-client-content-negotiation:$ktor_version") api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") + api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation("io.ktor:ktor-client-mock:$ktor_version") } } - val jvmMain by getting { + jvmMain { dependencies { implementation(kotlin("stdlib-jdk7")) implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit")) } } - val iosMain by getting { + iosMain { dependencies { api("io.ktor:ktor-client-ios:$ktor_version") } } - val iosTest by getting - - val iosSimulatorArm64Main by getting - - val iosSimulatorArm64Test by getting - - iosSimulatorArm64Main.dependsOn(iosMain) - iosSimulatorArm64Test.dependsOn(iosTest) - val jsMain by getting { dependencies { api("io.ktor:ktor-client-js:$ktor_version") } } - val jsTest by getting - all { languageSettings.apply { optIn("kotlin.Experimental") diff --git a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt index 5aeea0894894..b5b7054f9092 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(Base64ByteArray.Companion::class) class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) diff --git a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt index af8caa633ccb..df72899875bd 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt @@ -82,6 +82,7 @@ private fun ByteReadPacket.encodeBase64(): String = buildString { * * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt */ +@Suppress("DEPRECATION") private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { val data = ByteArray(4) diff --git a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt index d10d7c506523..96339312ada4 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/build.gradle.kts b/samples/client/petstore/kotlin-default-values-multiplatform/build.gradle.kts index 8482c5193fa0..37d36cad1458 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/build.gradle.kts +++ b/samples/client/petstore/kotlin-default-values-multiplatform/build.gradle.kts @@ -1,17 +1,17 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform") version "1.7.21" // kotlin_version - kotlin("plugin.serialization") version "1.7.21" // kotlin_version + kotlin("multiplatform") version "1.9.20" // kotlin_version + kotlin("plugin.serialization") version "1.9.20" // kotlin_version } group = "org.openapitools" version = "1.0.0" -val kotlin_version = "1.7.21" -val coroutines_version = "1.6.4" -val serialization_version = "1.3.3" -val ktor_version = "2.2.3" +val kotlin_version = "1.9.20" +val coroutines_version = "1.7.3" +val serialization_version = "1.6.1" +val ktor_version = "2.3.6" repositories { mavenCentral() @@ -19,15 +19,16 @@ repositories { kotlin { jvm() - ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } - iosSimulatorArm64 { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } + iosX64() + iosArm64() + iosSimulatorArm64() js { browser() nodejs() } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") @@ -37,53 +38,42 @@ kotlin { api("io.ktor:ktor-client-content-negotiation:$ktor_version") api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") + api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation("io.ktor:ktor-client-mock:$ktor_version") } } - val jvmMain by getting { + jvmMain { dependencies { implementation(kotlin("stdlib-jdk7")) implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit")) } } - val iosMain by getting { + iosMain { dependencies { api("io.ktor:ktor-client-ios:$ktor_version") } } - val iosTest by getting - - val iosSimulatorArm64Main by getting - - val iosSimulatorArm64Test by getting - - iosSimulatorArm64Main.dependsOn(iosMain) - iosSimulatorArm64Test.dependsOn(iosTest) - val jsMain by getting { dependencies { api("io.ktor:ktor-client-js:$ktor_version") } } - val jsTest by getting - all { languageSettings.apply { optIn("kotlin.Experimental") diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt index 5aeea0894894..b5b7054f9092 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(Base64ByteArray.Companion::class) class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt index af8caa633ccb..df72899875bd 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt @@ -82,6 +82,7 @@ private fun ByteReadPacket.encodeBase64(): String = buildString { * * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt */ +@Suppress("DEPRECATION") private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { val data = ByteArray(4) diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt index d10d7c506523..96339312ada4 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/build.gradle.kts b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/build.gradle.kts index 8482c5193fa0..37d36cad1458 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/build.gradle.kts +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/build.gradle.kts @@ -1,17 +1,17 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform") version "1.7.21" // kotlin_version - kotlin("plugin.serialization") version "1.7.21" // kotlin_version + kotlin("multiplatform") version "1.9.20" // kotlin_version + kotlin("plugin.serialization") version "1.9.20" // kotlin_version } group = "org.openapitools" version = "1.0.0" -val kotlin_version = "1.7.21" -val coroutines_version = "1.6.4" -val serialization_version = "1.3.3" -val ktor_version = "2.2.3" +val kotlin_version = "1.9.20" +val coroutines_version = "1.7.3" +val serialization_version = "1.6.1" +val ktor_version = "2.3.6" repositories { mavenCentral() @@ -19,15 +19,16 @@ repositories { kotlin { jvm() - ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } - iosSimulatorArm64 { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } + iosX64() + iosArm64() + iosSimulatorArm64() js { browser() nodejs() } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") @@ -37,53 +38,42 @@ kotlin { api("io.ktor:ktor-client-content-negotiation:$ktor_version") api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") + api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation("io.ktor:ktor-client-mock:$ktor_version") } } - val jvmMain by getting { + jvmMain { dependencies { implementation(kotlin("stdlib-jdk7")) implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit")) } } - val iosMain by getting { + iosMain { dependencies { api("io.ktor:ktor-client-ios:$ktor_version") } } - val iosTest by getting - - val iosSimulatorArm64Main by getting - - val iosSimulatorArm64Test by getting - - iosSimulatorArm64Main.dependsOn(iosMain) - iosSimulatorArm64Test.dependsOn(iosTest) - val jsMain by getting { dependencies { api("io.ktor:ktor-client-js:$ktor_version") } } - val jsTest by getting - all { languageSettings.apply { optIn("kotlin.Experimental") diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index 28cc788be291..ec709473d75a 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -160,9 +160,8 @@ open class PetApi : ApiClient { ).wrap().map { value } } - @Serializable + @Serializable(FindPetsByStatusResponse.Companion::class) private class FindPetsByStatusResponse(val value: List) { - @Serializer(FindPetsByStatusResponse::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor @@ -204,9 +203,8 @@ open class PetApi : ApiClient { ).wrap().map { value } } - @Serializable + @Serializable(FindPetsByTagsResponse.Companion::class) private class FindPetsByTagsResponse(val value: List) { - @Serializer(FindPetsByTagsResponse::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index f6b78d2262ef..83a909297ee7 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -105,9 +105,8 @@ open class StoreApi : ApiClient { ).wrap().map { value } } - @Serializable + @Serializable(GetInventoryResponse.Companion::class) private class GetInventoryResponse(val value: Map) { - @Serializer(GetInventoryResponse::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt index 510d4c46c7bb..305871ff4ef2 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt @@ -104,9 +104,8 @@ open class UserApi : ApiClient { ).wrap() } - @Serializable + @Serializable(CreateUsersWithArrayInputRequest.Companion::class) private class CreateUsersWithArrayInputRequest(val value: List) { - @Serializer(CreateUsersWithArrayInputRequest::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor @@ -145,9 +144,8 @@ open class UserApi : ApiClient { ).wrap() } - @Serializable + @Serializable(CreateUsersWithListInputRequest.Companion::class) private class CreateUsersWithListInputRequest(val value: List) { - @Serializer(CreateUsersWithListInputRequest::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt index 5aeea0894894..b5b7054f9092 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(Base64ByteArray.Companion::class) class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt index af8caa633ccb..df72899875bd 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt @@ -82,6 +82,7 @@ private fun ByteReadPacket.encodeBase64(): String = buildString { * * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt */ +@Suppress("DEPRECATION") private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { val data = ByteArray(4) diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt index d10d7c506523..96339312ada4 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) diff --git a/samples/client/petstore/kotlin-multiplatform/build.gradle.kts b/samples/client/petstore/kotlin-multiplatform/build.gradle.kts index 8482c5193fa0..37d36cad1458 100644 --- a/samples/client/petstore/kotlin-multiplatform/build.gradle.kts +++ b/samples/client/petstore/kotlin-multiplatform/build.gradle.kts @@ -1,17 +1,17 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform") version "1.7.21" // kotlin_version - kotlin("plugin.serialization") version "1.7.21" // kotlin_version + kotlin("multiplatform") version "1.9.20" // kotlin_version + kotlin("plugin.serialization") version "1.9.20" // kotlin_version } group = "org.openapitools" version = "1.0.0" -val kotlin_version = "1.7.21" -val coroutines_version = "1.6.4" -val serialization_version = "1.3.3" -val ktor_version = "2.2.3" +val kotlin_version = "1.9.20" +val coroutines_version = "1.7.3" +val serialization_version = "1.6.1" +val ktor_version = "2.3.6" repositories { mavenCentral() @@ -19,15 +19,16 @@ repositories { kotlin { jvm() - ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } - iosSimulatorArm64 { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } + iosX64() + iosArm64() + iosSimulatorArm64() js { browser() nodejs() } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") @@ -37,53 +38,42 @@ kotlin { api("io.ktor:ktor-client-content-negotiation:$ktor_version") api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") + api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation("io.ktor:ktor-client-mock:$ktor_version") } } - val jvmMain by getting { + jvmMain { dependencies { implementation(kotlin("stdlib-jdk7")) implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit")) } } - val iosMain by getting { + iosMain { dependencies { api("io.ktor:ktor-client-ios:$ktor_version") } } - val iosTest by getting - - val iosSimulatorArm64Main by getting - - val iosSimulatorArm64Test by getting - - iosSimulatorArm64Main.dependsOn(iosMain) - iosSimulatorArm64Test.dependsOn(iosTest) - val jsMain by getting { dependencies { api("io.ktor:ktor-client-js:$ktor_version") } } - val jsTest by getting - all { languageSettings.apply { optIn("kotlin.Experimental") diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index 28cc788be291..ec709473d75a 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -160,9 +160,8 @@ open class PetApi : ApiClient { ).wrap().map { value } } - @Serializable + @Serializable(FindPetsByStatusResponse.Companion::class) private class FindPetsByStatusResponse(val value: List) { - @Serializer(FindPetsByStatusResponse::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor @@ -204,9 +203,8 @@ open class PetApi : ApiClient { ).wrap().map { value } } - @Serializable + @Serializable(FindPetsByTagsResponse.Companion::class) private class FindPetsByTagsResponse(val value: List) { - @Serializer(FindPetsByTagsResponse::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index f6b78d2262ef..83a909297ee7 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -105,9 +105,8 @@ open class StoreApi : ApiClient { ).wrap().map { value } } - @Serializable + @Serializable(GetInventoryResponse.Companion::class) private class GetInventoryResponse(val value: Map) { - @Serializer(GetInventoryResponse::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt index 510d4c46c7bb..305871ff4ef2 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt @@ -104,9 +104,8 @@ open class UserApi : ApiClient { ).wrap() } - @Serializable + @Serializable(CreateUsersWithArrayInputRequest.Companion::class) private class CreateUsersWithArrayInputRequest(val value: List) { - @Serializer(CreateUsersWithArrayInputRequest::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor @@ -145,9 +144,8 @@ open class UserApi : ApiClient { ).wrap() } - @Serializable + @Serializable(CreateUsersWithListInputRequest.Companion::class) private class CreateUsersWithListInputRequest(val value: List) { - @Serializer(CreateUsersWithListInputRequest::class) companion object : KSerializer { private val serializer: KSerializer> = serializer>() override val descriptor = serializer.descriptor diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt index 5aeea0894894..b5b7054f9092 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(Base64ByteArray.Companion::class) class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt index af8caa633ccb..df72899875bd 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt @@ -82,6 +82,7 @@ private fun ByteReadPacket.encodeBase64(): String = buildString { * * Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt */ +@Suppress("DEPRECATION") private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket { val data = ByteArray(4) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt index d10d7c506523..96339312ada4 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -4,9 +4,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* -@Serializable +@Serializable(OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value))