Oh, Thanks for quick reply. It seems that I misunderstood. I read the same link that you provided, but I thought that "Moving any fields into an existing oneof is not safe." includes adding new fields to existing one too.
Best Regards On Sunday, March 29, 2020 at 11:06:08 PM UTC+4:30, Nadav Samet wrote: > > 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] <javascript:>> > 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] <javascript:>. >> 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/b7824e06-2833-4b0b-987b-47fbcb760685%40googlegroups.com.
