Open purrgrammer opened 4 years ago
It'd be really nice to add compatibility kotlin extensions for serialization. It currently doesn't exist for UUIDs but could be acheived using a small wrapper class. Something like:
@Serializer(forClass = UUID::class)
object UUIDSerializer : KSerializer<UUID> {
override val descriptor: SerialDescriptor
get() = StringDescriptor.withName("UUID")
override fun serialize(output: Encoder, obj: UUID) {
output.encodeString(obj.toString())
}
override fun deserialize(input: Decoder): UUID {
return UUID.fromString(input.decode())
}
}
References:
Like
memeid-scala
, which wraps our UUID type with an idiomatic API for the language.