forked from loafle/openapi-generator-original
[kotlin][client] small improvements (#9640)
* [kotlin][client] standardize adapter type names * [kotlin][client] remove unused class * [kotlin][client] fix IDE warning * [kotlin][client] improve import layout * [kotlin][client] update sample projects
This commit is contained in:
@@ -20,7 +20,6 @@ src/main/kotlin/org/openapitools/client/apis/UserApi.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.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
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import android.os.Build
|
||||
import okhttp3.Credentials
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
|
||||
@@ -12,7 +12,7 @@ object Serializer {
|
||||
.add(LocalDateAdapter())
|
||||
.add(UUIDAdapter())
|
||||
.add(ByteArrayAdapter())
|
||||
.add(UriAdapter())
|
||||
.add(URIAdapter())
|
||||
.add(KotlinJsonAdapterFactory())
|
||||
.add(BigDecimalAdapter())
|
||||
.add(BigIntegerAdapter())
|
||||
|
||||
@@ -4,10 +4,10 @@ import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.net.URI
|
||||
|
||||
class UriAdapter {
|
||||
class URIAdapter {
|
||||
@ToJson
|
||||
fun toJson(uri: URI) = uri.toString()
|
||||
|
||||
@FromJson
|
||||
fun fromJson(s: String) = URI.create(s)
|
||||
fun fromJson(s: String): URI = URI.create(s)
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ class UUIDAdapter {
|
||||
fun toJson(uuid: UUID) = uuid.toString()
|
||||
|
||||
@FromJson
|
||||
fun fromJson(s: String) = UUID.fromString(s)
|
||||
fun fromJson(s: String): UUID = UUID.fromString(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user