nested oneof don't compile

30 views
Skip to first unread message

Jon Ross

unread,
Sep 28, 2020, 7:55:44 PM9/28/20
to Protocol Buffers

In the following example I get two "Missing field number", one of each of the nested oneof. The docs say you can't nest maps in a oneof. they don't say anything about other oneofs.

protoc --version says : libprotoc 3.13.0

syntax = "proto3";

message typeOne {
  int32 weight = 1;
  string color =2;
}
message typeTwo {
  int64 time=1;
}
message typeThree {
  string name = 1;
  bool isHappy = 2;
}

message wireMessage {
  oneof msgType {
    oneof goodOnes {
      typeOne one = 1;
      typeThree three = 2;
    }
    oneof badOnes {
      typeTwo = 1;
      typeTwo = 1;
    }
  }
}


Reply all
Reply to author
Forward
0 new messages