forked from loafle/openapi-generator-original
feat(adapter): add BigDecimal kotlin support (#8880)
* feat(adapter): add BigDecimal kotlin support this allows the kotlin client generator to support BigDecimal values Fixes #7196 * update samples Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
parent
3929afff7d
commit
b5dac42959
@ -463,6 +463,8 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
|
||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
||||||
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigDecimalAdapter.kt.mustache", infrastructureFolder, "BigDecimalAdapter.kt"));
|
||||||
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigIntegerAdapter.kt.mustache", infrastructureFolder, "BigIntegerAdapter.kt"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gson:
|
case gson:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package {{packageName}}.infrastructure
|
package {{packageName}}.infrastructure
|
||||||
|
|
||||||
|
{{#kotlinx_serialization}}
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.Serializer
|
import kotlinx.serialization.Serializer
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
@ -7,13 +8,26 @@ import kotlinx.serialization.encoding.Encoder
|
|||||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
|
{{/kotlinx_serialization}}
|
||||||
|
{{#moshi}}
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
{{/moshi}}
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
@Serializer(forClass = BigDecimal::class)
|
{{#kotlinx_serialization}}@Serializer(forClass = BigDecimal::class)
|
||||||
object BigDecimalAdapter : KSerializer<BigDecimal> {
|
object BigDecimalAdapter : KSerializer<BigDecimal> {
|
||||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString())
|
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString())
|
||||||
|
|
||||||
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString())
|
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString())
|
||||||
}
|
}{{/kotlinx_serialization}}{{#moshi}}{{#nonPublicApi}}internal {{/nonPublicApi}}class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}{{/moshi}}
|
@ -1,5 +1,6 @@
|
|||||||
package {{packageName}}.infrastructure
|
package {{packageName}}.infrastructure
|
||||||
|
|
||||||
|
{{#kotlinx_serialization}}
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.Serializer
|
import kotlinx.serialization.Serializer
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
@ -7,12 +8,16 @@ import kotlinx.serialization.encoding.Encoder
|
|||||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
|
{{/kotlinx_serialization}}
|
||||||
|
{{#moshi}}
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
{{/moshi}}
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
|
|
||||||
@Serializer(forClass = BigInteger::class)
|
{{#kotlinx_serialization}}@Serializer(forClass = BigInteger::class)
|
||||||
object BigIntegerAdapter : KSerializer<BigInteger> {
|
object BigIntegerAdapter : KSerializer<BigInteger> {
|
||||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigInteger", PrimitiveKind.STRING)
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigInteger", PrimitiveKind.STRING)
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): BigInteger {
|
override fun deserialize(decoder: Decoder): BigInteger {
|
||||||
return BigInteger(decoder.decodeString())
|
return BigInteger(decoder.decodeString())
|
||||||
}
|
}
|
||||||
@ -20,4 +25,14 @@ object BigIntegerAdapter : KSerializer<BigInteger> {
|
|||||||
override fun serialize(encoder: Encoder, value: BigInteger) {
|
override fun serialize(encoder: Encoder, value: BigInteger) {
|
||||||
encoder.encodeString(value.toString())
|
encoder.encodeString(value.toString())
|
||||||
}
|
}
|
||||||
}
|
}{{/kotlinx_serialization}}{{#moshi}}{{#nonPublicApi}}internal {{/nonPublicApi}}class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}{{/moshi}}
|
@ -63,6 +63,8 @@ import java.util.concurrent.atomic.AtomicLong
|
|||||||
{{^moshiCodeGen}}
|
{{^moshiCodeGen}}
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
{{/moshiCodeGen}}
|
{{/moshiCodeGen}}
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -459,7 +459,7 @@ public class DefaultGeneratorTest {
|
|||||||
|
|
||||||
List<File> files = generator.opts(clientOptInput).generate();
|
List<File> files = generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Assert.assertEquals(files.size(), 24);
|
Assert.assertEquals(files.size(), 26);
|
||||||
|
|
||||||
// Generator should report a library templated file as a generated file
|
// Generator should report a library templated file as a generated file
|
||||||
TestUtils.ensureContainsFile(files, output, "src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt");
|
TestUtils.ensureContainsFile(files, output, "src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt");
|
||||||
@ -501,7 +501,7 @@ public class DefaultGeneratorTest {
|
|||||||
|
|
||||||
List<File> files = generator.opts(clientOptInput).generate();
|
List<File> files = generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Assert.assertEquals(files.size(), 24);
|
Assert.assertEquals(files.size(), 26);
|
||||||
|
|
||||||
// Generator should report README.md as a generated file
|
// Generator should report README.md as a generated file
|
||||||
TestUtils.ensureContainsFile(files, output, "README.md");
|
TestUtils.ensureContainsFile(files, output, "README.md");
|
||||||
@ -566,7 +566,7 @@ public class DefaultGeneratorTest {
|
|||||||
|
|
||||||
List<File> files = generator.opts(clientOptInput).generate();
|
List<File> files = generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Assert.assertEquals(files.size(), 24);
|
Assert.assertEquals(files.size(), 26);
|
||||||
|
|
||||||
// Generator should report a library templated file as a generated file
|
// Generator should report a library templated file as a generated file
|
||||||
TestUtils.ensureContainsFile(files, output, "src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt");
|
TestUtils.ensureContainsFile(files, output, "src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt");
|
||||||
@ -620,7 +620,7 @@ public class DefaultGeneratorTest {
|
|||||||
|
|
||||||
List<File> files = generator.opts(clientOptInput).generate();
|
List<File> files = generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
Assert.assertEquals(files.size(), 24);
|
Assert.assertEquals(files.size(), 26);
|
||||||
|
|
||||||
// Generator should report README.md as a generated file
|
// Generator should report README.md as a generated file
|
||||||
TestUtils.ensureContainsFile(files, output, "README.md");
|
TestUtils.ensureContainsFile(files, output, "README.md");
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,8 @@ object Serializer {
|
|||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
internal class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
internal class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ internal object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -12,8 +12,6 @@ import java.math.BigDecimal
|
|||||||
@Serializer(forClass = BigDecimal::class)
|
@Serializer(forClass = BigDecimal::class)
|
||||||
object BigDecimalAdapter : KSerializer<BigDecimal> {
|
object BigDecimalAdapter : KSerializer<BigDecimal> {
|
||||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString())
|
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString())
|
||||||
|
|
||||||
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString())
|
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString())
|
||||||
}
|
}
|
@ -12,7 +12,6 @@ import java.math.BigInteger
|
|||||||
@Serializer(forClass = BigInteger::class)
|
@Serializer(forClass = BigInteger::class)
|
||||||
object BigIntegerAdapter : KSerializer<BigInteger> {
|
object BigIntegerAdapter : KSerializer<BigInteger> {
|
||||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigInteger", PrimitiveKind.STRING)
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigInteger", PrimitiveKind.STRING)
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): BigInteger {
|
override fun deserialize(decoder: Decoder): BigInteger {
|
||||||
return BigInteger(decoder.decodeString())
|
return BigInteger(decoder.decodeString())
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ src/main/kotlin/org/openapitools/client/auth/OAuth.kt
|
|||||||
src/main/kotlin/org/openapitools/client/auth/OAuthFlow.kt
|
src/main/kotlin/org/openapitools/client/auth/OAuthFlow.kt
|
||||||
src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt
|
src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.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/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.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/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -22,6 +22,8 @@ src/main/kotlin/org/openapitools/client/auth/OAuth.kt
|
|||||||
src/main/kotlin/org/openapitools/client/auth/OAuthFlow.kt
|
src/main/kotlin/org/openapitools/client/auth/OAuthFlow.kt
|
||||||
src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt
|
src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.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/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.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/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -12,6 +12,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
@ -21,6 +21,8 @@ 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/ApiClient.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.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/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
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ object Serializer {
|
|||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
.add(ByteArrayAdapter())
|
.add(ByteArrayAdapter())
|
||||||
.add(KotlinJsonAdapterFactory())
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshi: Moshi by lazy {
|
val moshi: Moshi by lazy {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user