While it's nice Google provides an official implementation for Kotlin, I recommend https://github.com/open-toast/protokt. It's nicer to use as it is kotlin-only (instead of kotlin-java mix), including nice handling of `optional`fields, and has a potential of being multiplatform.
K 2
π― 1
π 1
s
suresh
11/02/2021, 5:31 PM
@mcpiroman since 1.2 onwards kotlinx-serialization has support for generating the schema (
.proto
) and itβs already multiplatform ready, are there any advantage in using protokt?
m
mcpiroman
11/02/2021, 5:51 PM
Mainly proto3. I don't quite know how kotlinx-serialization works (have not used it) but, at least for now, I would also expect faster compilation or slightly better usage of the wire (being on lower level). There were also problems with combining kotlinx-serialization and Compose in the same module but I don't think this is much of a breaker.
π 1
e
ephemient
11/02/2021, 11:39 PM
the official protobuf generator produces a Kotlin DSL which kotlinx.serialization doesn't (although you could write your own). protokt does, though I haven't compared them
ephemient
11/02/2021, 11:42 PM
note that only kotlinx.serialization works on non-JVM platforms; protobuf and protokt both use Java code and/or JVM libraries