Could you post the code you're using to serialize and parse the message? Field numbers 1 through 15 are unique in the sense that they require only one byte, as a result of the way the field number and wire type are stored together in a varint <https://developers.google.com/protocol-buffers/docs/encoding#varints> (variable-sized int). Starting from field number 16 you will need at least two bytes. However, this shouldn't really matter unless your code is assuming that the serialized message is always the same size.
On Mon, Jul 13, 2020 at 4:01 AM Adrian Antonana <[email protected]> wrote: > Hello there, > > I have a message definition with a oneof with 50 fields inside from which > I generate C++ code: > > message Req { > oneof req{ > Foo foo = 1; > Bar bar = 2; > ... > Baz baz = 50; > } > } > > Where Baz is: > > message Baz { > string path = 1; > } > > > The problem is that, on the receiving end, switch-casing the "req_case()" > fails to match the Baz message. But if I assign it a field number <= 15 in > the oneof, then it works. > > Debug printing the message on the receiving end (for field numbers >15) > shows nothing but for lower values I get: > > baz { > path: "foo" > } > > From the guide ( > https://developers.google.com/protocol-buffers/docs/proto3#assigning_field_numbers) > I see one should be able to assign field numbers in the range 1 - 2^^29-1 > (excluding 19000-19999). > > I'm I overlooking something? > > Thanks in advance! > > -- > 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/08e8b9d1-5171-4d33-9a97-9ac4228da332o%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/08e8b9d1-5171-4d33-9a97-9ac4228da332o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADqAXr7Fr7CL%2BCNTBtFvUs-sRuVojPHDvspEahdK6yDJCPmO0A%40mail.gmail.com.
