mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 19:07:05 +00:00
[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:
@@ -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