The reasoning for unknown enums being treated as unknown fields goes
something like this:
We cannot simply use an unknown numeric value since many languages do not
allow enum types to represent numeric values other than the set of values
explicitly defined for them. Furthermore, even if they did, this could lead
to security problems: people might write server code which assumes that an
enum field has one of the defined values and does something bad if it isn't.
Such problems could easily get past code review and testing.
On the other hand, in the case of servers which simply act as a proxy,
forwarding messages elsewhere, we do not want to have to upgrade these
servers every time a new enum value is added to the proto definition.
Instead, we would like these servers to be able to pass the message through
retaining the value they read in, valid or not. This is exactly why unknown
fields exist in the first place, so treating it as an unknown field seems
On Fri, Oct 24, 2008 at 1:53 PM, Marc Gravell <[EMAIL PROTECTED]>wrote:
> I might have found the answer... "if you try to provide a different
> value, the parser will treat it like an unknown field" (from the
> language guide). So this means that enums are essentially unchecked:
> invalid values are silently ignored?
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at