Hi Afshin, adding a new field to an existing oneof is safe. Moving existing fields into a new or existing oneof *may* be unsafe as described in the language guide <https://developers.google.com/protocol-buffers/docs/proto3#updating>. Sounds like the guides you have looked into are inaccurate. If you don't mind, can you provide a link?
On Sun, Mar 29, 2020 at 10:19 AM Afshin <[email protected]> wrote: > Hi all > > When I was reading guides for protobuf 3, there was a huge limitation for > oneof field. The guide states that updating a message by adding new fields > to an existing oneof field is not safe. For example, if I have following > message: > > message TestIt { > oneof my_field { > DataA a = 1; > DataB b = 2; > } > } > > I cannot update it to the this new message: > > message TestIt { > oneof my_field { > DataA a = 1; > DataB b = 2; > DataC c = 3; > } > } > > I think this is a really huge limitation for oneof field and makes it > useless in a lot of cases. Is there any way to achieve something similar > without using Any object? > > -- > 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/cdfd705b-7504-4220-93b7-0d2e3bc9c82f%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/cdfd705b-7504-4220-93b7-0d2e3bc9c82f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -Nadav -- 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/CANZcNEpnpRU2OjshAT2g1%2BG8-4NfD-65%2BCt8Wag9%3D5P7%2BFHCww%40mail.gmail.com.
