Provide a default serializer for kotlin.uuid.Uuid class
Kotlin 2.0.20 is expected to have a new MPP UUID class (https://youtrack.jetbrains.com/issue/KT-31880, https://github.com/JetBrains/kotlin/commit/25ea5e81af6a1e3638228498f0dea57b7efe5d15). It is reasonable to provide a built-in serializer for it, like we did for kotlin.time.Duration when it was moved to stdlib.
Adding a built-in serializer requires changes in the plugin too, so they have to be made in time, preferably in the same Kotlin 2.0.20 or Kotlin 2.1
How do you want to serialize it for different formats? In string formats, like JSON, properties, xml etc., it is common to use the string representation, but for binary formats, a compact binary (using the two longs directly) would be preferred than encoding the string.
Good question. Initially, I was planning to add only String representation, but maybe binary serializer is also required as an additional one
Apparently, there is no standardized way of storing UUIDs in protobuf (https://github.com/protocolbuffers/protobuf/issues/2224, https://groups.google.com/g/protobuf/c/THxuTQKsz54). Various implementations use string, bytes, or a pair of fixed64/uint64.
For CBOR, there is tag 37 for UUID byte string (https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml), which is an accepted extension described here: https://github.com/lucas-clemente/cbor-specs/blob/master/uuid.md
So it looks like, for now, only CBOR requires additional handling.
On the avro binary format, the uuid is officially represented as a string as said by the spec (the default official uuid type), but is also usually serialized as a fixed of 16 bytes to save space (36 characters/bytes vs 16 bytes), so we may also want to handle a uuid differently depending on the user config.
EDIT:
Btw, this is the same for kotlin.time.Duration where the official representation is a fixed of 12 bytes
Well, in the case of format-specific serializers, you can always mark Duration or Uuid with @Contextual and provide a module for Avro/Cbor. If SerializersModule is empty, a default serializer will be used for e.g. Json.
Just raised a ticket on the former de-facto uuid implementation for Kotlin with some findings about binary serialization, if anyone is interested: https://github.com/hfhbd/kotlinx-uuid/issues/422