update exposed and adapt to new version of kotlin serialization

This commit is contained in:
InsanusMokrassar 2021-12-28 21:16:34 +06:00
parent d45aef9fe5
commit f4ee6c2890
5 changed files with 19 additions and 15 deletions

1
.gitignore vendored
View File

@ -12,4 +12,5 @@ out/
secret.gradle
local.properties
publishing.sh

View File

@ -1,5 +1,15 @@
# Changelog
## 0.9.0
* `Versions`:
* `Kotlin`: `1.5.31` -> `1.6.10`
* `Coroutines`: `1.5.2` -> `1.6.0`
* `Serialization`: `1.3.1` -> `1.3.2`
* `Exposed`: `0.36.2` -> `0.37.2`
* `Ktor`: `1.6.5` -> `1.6.7`
* `Klock`: `2.4.8` -> `2.4.10`
## 0.8.9
* `Ktor`:

View File

@ -32,8 +32,7 @@ class EitherSerializer<T1, T2>(
t1Serializer: KSerializer<T1>,
t2Serializer: KSerializer<T2>,
) : KSerializer<Either<T1, T2>> {
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor(
"TypedSerializer",
SerialKind.CONTEXTUAL
@ -44,8 +43,7 @@ class EitherSerializer<T1, T2>(
private val t1EitherSerializer = EitherFirst.serializer(t1Serializer, t2Serializer)
private val t2EitherSerializer = EitherSecond.serializer(t1Serializer, t2Serializer)
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
override fun deserialize(decoder: Decoder): Either<T1, T2> {
return decoder.decodeStructure(descriptor) {
var type: String? = null
@ -77,8 +75,7 @@ class EitherSerializer<T1, T2>(
}
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
override fun serialize(encoder: Encoder, value: Either<T1, T2>) {
encoder.encodeStructure(descriptor) {
when (value) {

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx2g
kotlin_version=1.6.10
kotlin_coroutines_version=1.6.0
kotlin_serialisation_core_version=1.3.2
kotlin_exposed_version=0.37.1
kotlin_exposed_version=0.37.2
ktor_version=1.6.7

View File

@ -11,8 +11,7 @@ open class TypedSerializer<T : Any>(
presetSerializers: Map<String, KSerializer<out T>> = emptyMap(),
) : KSerializer<T> {
protected val serializers = presetSerializers.toMutableMap()
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(InternalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor(
"TypedSerializer",
SerialKind.CONTEXTUAL
@ -21,8 +20,7 @@ open class TypedSerializer<T : Any>(
element("value", ContextualSerializer(kClass).descriptor)
}
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
override fun deserialize(decoder: Decoder): T {
return decoder.decodeStructure(descriptor) {
var type: String? = null
@ -46,14 +44,12 @@ open class TypedSerializer<T : Any>(
}
}
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
protected open fun <O: T> CompositeEncoder.encode(value: O) {
encodeSerializableElement(descriptor, 1, value::class.serializer() as KSerializer<O>, value)
}
@ExperimentalSerializationApi
@InternalSerializationApi
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
override fun serialize(encoder: Encoder, value: T) {
encoder.encodeStructure(descriptor) {
val valueSerializer = value::class.serializer()