I want to define in proto3 an ordered list of unrelated classes (messages) like this:
Is it possible? I can also live with having a base class (base message) if that exists in proto3... Its not clear to mean if the feature set of proto3 allows this. Thanks!
The typical way of representing this would be
message Wrapper {
oneof Thing {
Frog frog = 1;
//...
Politics politics = 6;
}
}
and use repeated Wrapper
for the list/array. There is no one-step repeated oneof
.
Alternatively, you could just use
repeated Frog frogs = 1;
//...
repeated Politics politics = 6;
However this second layout cannot preserve the order between different kinds of element.