diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/json/DashlessUUIDSerializer.kt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/json/DashlessUUIDSerializer.kt b/src/main/kotlin/moe/nea/firmament/util/json/DashlessUUIDSerializer.kt index c95b343..3dca217 100644 --- a/src/main/kotlin/moe/nea/firmament/util/json/DashlessUUIDSerializer.kt +++ b/src/main/kotlin/moe/nea/firmament/util/json/DashlessUUIDSerializer.kt @@ -2,7 +2,6 @@ package moe.nea.firmament.util.json import java.util.UUID import kotlinx.serialization.KSerializer -import kotlinx.serialization.Serializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor @@ -15,7 +14,11 @@ object DashlessUUIDSerializer : KSerializer<UUID> { PrimitiveSerialDescriptor("DashlessUUIDSerializer", PrimitiveKind.STRING) override fun deserialize(decoder: Decoder): UUID { - return parseDashlessUUID(decoder.decodeString()) + val str = decoder.decodeString() + if ("-" in str) { + return UUID.fromString(str) + } + return parseDashlessUUID(str) } override fun serialize(encoder: Encoder, value: UUID) { |