>
> What representations do you mean? In general it is not expected that oneof
> names are exposed in wire formats. Authors of .proto files are free to
> change them at will without breaking the wire.
>
An example would be code that produces an alternative JSON representation
that groups all the fields of a oneof inside a nested object. For example
if a message like
message MyMessage {
oneof foo {
int32 v = 1
}
}
gets encoded to JSON by user's code as:
"my_one_of": {"foo": 5}}
Then such code would have to be modified to treat synthetic
oneofs differently.
> Can you give an example of some of the code that would be affected?
>
Some users use oneofs to build ADTs, and for them oneofs should never be
empty <https://github.com/scalapb/ScalaPB/issues/633>. To enforce this at
runtime, they may have written a validator that takes an instance of a
message, and uses its descriptor to traverse all the oneofs and fail when
it finds a oneof where none of its fields is set. With the proposed change,
this validator would have to be changed to only care about non-synthetic
oneofs.
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/CANZcNEojEGQ4KES%3D7cd%2BCpkJ-Qs_3EBKOTpZ_c_JdLH7SOHg1Q%40mail.gmail.com.