aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-04-16 18:07:11 +0200
committerRobert Jaros <rjaros@finn.pl>2019-04-16 18:07:11 +0200
commit856d753c7f335dacd9cc4daf666a152378886200 (patch)
tree549c667ba6047a0405bd112d8e91be117c798012 /src/main/kotlin/pl
parent2382d82d5aaed8e6519da9e82d771ee94007b2cd (diff)
downloadkvision-856d753c7f335dacd9cc4daf666a152378886200.tar.gz
kvision-856d753c7f335dacd9cc4daf666a152378886200.tar.bz2
kvision-856d753c7f335dacd9cc4daf666a152378886200.zip
Upgrade Kotlin to 1.3.30
Upgrade coroutines to 1.2.0 Upgrade serialization to 0.11.0 Upgrade Ktor to 1.1.4 Upgrade Spring Boot to 2.1.4
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/Form.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt14
2 files changed, 12 insertions, 12 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt
index a2d6848c..2c71e6a1 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt
@@ -24,8 +24,7 @@ package pl.treksoft.kvision.form
import kotlinx.serialization.ImplicitReflectionSerializer
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Mapper
-import kotlinx.serialization.context.MutableSerialContextImpl
-import kotlinx.serialization.decode
+import kotlinx.serialization.modules.serializersModuleOf
import kotlinx.serialization.serializer
import pl.treksoft.kvision.i18n.I18n.trans
import pl.treksoft.kvision.types.DateSerializer
@@ -107,9 +106,10 @@ class Form<K : Any>(private val panel: FormPanel<K>? = null, private val seriali
else -> listOf(entry.key to entry.value)
}
}.toMap()
- val mapper = Mapper().InNullableMapper(FormMapWrapper(map))
- mapper.context = MutableSerialContextImpl().apply { registerSerializer(Date::class, DateSerializer) }
- mapper.decode(serializer)
+ Mapper(context = serializersModuleOf(Date::class, DateSerializer)).unmapNullable(
+ serializer,
+ FormMapWrapper(map)
+ )
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt b/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
index e30935ab..8dd8a504 100644
--- a/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
@@ -23,8 +23,9 @@ package pl.treksoft.kvision.utils
import kotlinx.serialization.ImplicitReflectionSerializer
import kotlinx.serialization.SerializationStrategy
-import kotlinx.serialization.context.SimpleModule
import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonConfiguration
+import kotlinx.serialization.modules.serializersModuleOf
import kotlinx.serialization.serializer
import pl.treksoft.kvision.types.DateSerializer
import kotlin.js.Date
@@ -34,13 +35,12 @@ import kotlin.js.Date
*/
object JSON {
- val plain = Json().apply {
- install(SimpleModule(Date::class, DateSerializer))
- }
+ val plain = Json(context = serializersModuleOf(Date::class, DateSerializer))
- val nonstrict = Json(strictMode = false).apply {
- install(SimpleModule(Date::class, DateSerializer))
- }
+ val nonstrict = Json(
+ configuration = JsonConfiguration.Stable.copy(strictMode = false),
+ context = serializersModuleOf(Date::class, DateSerializer)
+ )
/**
* An extension function to convert Serializable object to JS dynamic object