how to define repeated field as required in Google protocol buffer?I have a field that modifier is repeated(repeated int32 A ).How i add required modifier to this field? in fact i want to have both modifier(required and repeated).
Asked
Active
Viewed 3,273 times
1 Answers
7
Sorry, there is no way to mark a repeated field as "required".
In fact, required
itself is widely considered a misfeature and is being phased out in Protobuf 3.0. For an extended explanation/rant of why this is the case, see:
https://capnproto.org/faq.html#how-do-i-make-a-field-required-like-in-protocol-buffers
(That's a link to the Cap'n Proto web site, which is a competitor to Protobufs, but its author (namely, me) was also the main author of Protobuf v2.)

Kenton Varda
- 41,353
- 8
- 121
- 105