Hi guys,
Do you have plan to support proto3?
Thanks.
Hello,
Proto3 parser is not very hard to implement and even its format is compatible with proto2, however, there is a big semantic change: in proto3, there are no required or optional fields, every field that is not repeated, can be specified zero or one times. It does not map very well to Kotlin classes: basically, it means that you have to declare every field as optional and provide some default (which in many cases null, so your fields' types will be nullable, and imho that's not very convenient).
If you markup your classes in such way, current parser will likely work with Proto3 – except for packed encoding of repeated fields, which is not supported at all by now.
expect proto3 support too.
Any suggestion on how to handle empty lists with proto3?
Example:
@Serializable
data class Test (
@Optional @SerialId(1) var events: List<Event> = emptyList(),
@Optional @SerialId(2) var games: List<Game> = emptyList()
)
If for example events is "empty array" in proto3 response, Android deserializes just games correctly, while iOS throws Unexpected EOF. If I comment out empty events from the class above, iOS deserialization of just games succeeds as well.
Otherwise It works quite well even with proto3.
Edit
Separate issue created here #355
P.S. @sandwwraith - I didn't want to open stand alone issue at first, since proto3 is not (yet) supprted.
If you observe different behavior on different platforms with the same library and code, this is probably a bug and you can open separate issue
Hi,
Do you have a plan to support packed encoding of repeated fields ?
Thanks.
@kdarrimajou yes, this is something we are considering to do for 1.1 or 1.2 release. No commitment yet, but that's in our "to investigate" plan
@kdarrimajou yes, this is something we are considering to do for 1.1 or 1.2 release. No commitment yet, but that's in our "to investigate" plan
Thank you @qwwdfsad