You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifying Field Rules
Message fields can be one of the following:
singular: a well-formed message can have zero or one of this field (but not more than one). When using proto3 syntax, this is the default field rule when no other field rules are specified for a given field. You cannot determine whether it was parsed from the wire. It will be serialized to the wire unless it is the default value. For more on this subject, see [Field Presence](https://protobuf.dev/programming-guides/field_presence).
optional: the same as singular, except that you can check to see if the value was explicitly set. An optional field is in one of two possible states:
the field is set, and contains a value that was explicitly set or parsed from the wire. It will be serialized to the wire.
the field is unset, and will return the default value. It will not be serialized to the wire.
repeated: this field type can be repeated zero or more times in a well-formed message. The order of the repeated values will be preserved.
map: this is a paired key/value field type. See [Maps](https://protobuf.dev/programming-guides/encoding#maps) for more on this field type.
I don't think putting back optional on its own suffices. The spec gives a new behavior to it, which we'd have to take into account in the code as well!
It looks like
Optional
was removed in this PR: https://github.com/awakesecurity/proto3-suite/pull/165/filesThe reason given was that it wasn't supported in proto3, but it is in fact part of the spec, see: https://protobuf.dev/programming-guides/proto3/#specifying-field-rules
It was erroneously left out of early documentation per: protocolbuffers/protobuf#10463
Can that PR be reverted?
The text was updated successfully, but these errors were encountered: