mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 16:42:45 +00:00
Merge remote-tracking branch 'origin/6.3.x' into 7.0.x
This commit is contained in:
@@ -28,7 +28,6 @@ src/main/kotlin/org/openapitools/client/infrastructure/AtomicIntegerAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/AtomicLongAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# org.openapitools.client - Kotlin client library for OpenAPI Petstore
|
||||
|
||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
## Overview
|
||||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client.
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version:
|
||||
- Build package: org.openapitools.codegen.languages.KotlinClientCodegen
|
||||
|
||||
## Requires
|
||||
|
||||
* Kotlin 1.4.30
|
||||
|
||||
@@ -2,12 +2,12 @@ group 'org.openapitools'
|
||||
version '1.0.0'
|
||||
|
||||
wrapper {
|
||||
gradleVersion = '6.8.3'
|
||||
gradleVersion = '7.5'
|
||||
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.10'
|
||||
ext.kotlin_version = '1.6.10'
|
||||
ext.retrofitVersion = '2.9.0'
|
||||
|
||||
repositories {
|
||||
@@ -32,9 +32,9 @@ test {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3"
|
||||
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
# project specific.
|
||||
-keep,includedescriptorclasses class org.openapitools.client.models.**$$serializer { *; }
|
||||
-keepclassmembers class org.openapitools.client.models.** { *** Companion; }
|
||||
-keepclasseswithmembers class org.openapitools.client.models.** { kotlinx.serialization.KSerializer serializer(...); }
|
||||
-keepclasseswithmembers class org.openapitools.client.models.** { kotlinx.serialization.KSerializer serializer(...); }
|
||||
|
||||
@@ -4,6 +4,8 @@ import org.openapitools.client.infrastructure.CollectionFormats.*
|
||||
import retrofit2.http.*
|
||||
import retrofit2.Call
|
||||
import okhttp3.RequestBody
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
import org.openapitools.client.models.ModelApiResponse
|
||||
import org.openapitools.client.models.Pet
|
||||
@@ -36,6 +38,16 @@ interface PetApi {
|
||||
@DELETE("pet/{petId}")
|
||||
fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String? = null): Call<Unit>
|
||||
|
||||
|
||||
/**
|
||||
* enum for parameter status
|
||||
*/
|
||||
enum class Status_findPetsByStatus(val value: kotlin.String) {
|
||||
@SerialName(value = "available") AVAILABLE("available"),
|
||||
@SerialName(value = "pending") PENDING("pending"),
|
||||
@SerialName(value = "sold") SOLD("sold")
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
|
||||
@@ -4,6 +4,8 @@ import org.openapitools.client.infrastructure.CollectionFormats.*
|
||||
import retrofit2.http.*
|
||||
import retrofit2.Call
|
||||
import okhttp3.RequestBody
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
import org.openapitools.client.models.Order
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import org.openapitools.client.infrastructure.CollectionFormats.*
|
||||
import retrofit2.http.*
|
||||
import retrofit2.Call
|
||||
import okhttp3.RequestBody
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
import org.openapitools.client.models.User
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import retrofit2.Converter
|
||||
import retrofit2.converter.scalars.ScalarsConverterFactory
|
||||
|
||||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
||||
import org.openapitools.client.infrastructure.Serializer.jvmJson
|
||||
import org.openapitools.client.infrastructure.Serializer.kotlinxSerializationJson
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
|
||||
class ApiClient(
|
||||
@@ -32,7 +32,7 @@ class ApiClient(
|
||||
Retrofit.Builder()
|
||||
.baseUrl(baseUrl)
|
||||
.addConverterFactory(ScalarsConverterFactory.create())
|
||||
.addConverterFactory(jvmJson.asConverterFactory("application/json".toMediaType()))
|
||||
.addConverterFactory(kotlinxSerializationJson.asConverterFactory("application/json".toMediaType()))
|
||||
.apply {
|
||||
if (converterFactory != null) {
|
||||
addConverterFactory(converterFactory)
|
||||
|
||||
@@ -18,4 +18,4 @@ object AtomicBooleanAdapter : KSerializer<AtomicBoolean> {
|
||||
override fun deserialize(decoder: Decoder): AtomicBoolean = AtomicBoolean(decoder.decodeBoolean())
|
||||
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("AtomicBoolean", PrimitiveKind.BOOLEAN)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ object AtomicIntegerAdapter : KSerializer<AtomicInteger> {
|
||||
override fun deserialize(decoder: Decoder): AtomicInteger = AtomicInteger(decoder.decodeInt())
|
||||
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("AtomicInteger", PrimitiveKind.INT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ object AtomicLongAdapter : KSerializer<AtomicLong> {
|
||||
override fun deserialize(decoder: Decoder): AtomicLong = AtomicLong(decoder.decodeLong())
|
||||
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("AtomicLong", PrimitiveKind.LONG)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ object BigDecimalAdapter : KSerializer<BigDecimal> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
||||
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString())
|
||||
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ object BigIntegerAdapter : KSerializer<BigInteger> {
|
||||
override fun serialize(encoder: Encoder, value: BigInteger) {
|
||||
encoder.encodeString(value.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
|
||||
@@ -15,8 +15,13 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
object Serializer {
|
||||
@Deprecated("Use Serializer.kotlinxSerializationAdapters instead", replaceWith = ReplaceWith("Serializer.kotlinxSerializationAdapters"))
|
||||
@JvmStatic
|
||||
val kotlinSerializationAdapters = SerializersModule {
|
||||
val kotlinSerializationAdapters: SerializersModule
|
||||
get() { return kotlinxSerializationAdapters }
|
||||
|
||||
@JvmStatic
|
||||
val kotlinxSerializationAdapters = SerializersModule {
|
||||
contextual(BigDecimal::class, BigDecimalAdapter)
|
||||
contextual(BigInteger::class, BigIntegerAdapter)
|
||||
contextual(LocalDate::class, LocalDateAdapter)
|
||||
@@ -31,6 +36,17 @@ object Serializer {
|
||||
contextual(StringBuilder::class, StringBuilderAdapter)
|
||||
}
|
||||
|
||||
@Deprecated("Use Serializer.kotlinxSerializationJson instead", replaceWith = ReplaceWith("Serializer.kotlinxSerializationJson"))
|
||||
@JvmStatic
|
||||
val jvmJson: Json by lazy { Json { serializersModule = kotlinSerializationAdapters } }
|
||||
val jvmJson: Json
|
||||
get() { return kotlinxSerializationJson }
|
||||
|
||||
@JvmStatic
|
||||
val kotlinxSerializationJson: Json by lazy {
|
||||
Json {
|
||||
serializersModule = kotlinxSerializationAdapters
|
||||
ignoreUnknownKeys = true
|
||||
isLenient = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,4 @@ object StringBuilderAdapter : KSerializer<StringBuilder> {
|
||||
override fun deserialize(decoder: Decoder): StringBuilder = StringBuilder(decoder.decodeString())
|
||||
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("StringBuilder", PrimitiveKind.STRING)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ object URLAdapter : KSerializer<URL> {
|
||||
override fun deserialize(decoder: Decoder): URL = URL(decoder.decodeString())
|
||||
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("URL", PrimitiveKind.STRING)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
|
||||
Reference in New Issue
Block a user