Let's say I have this Protocol Buffers schema:
message Person{
enum Height{
UNDEFINED = 0;
TALL = 1;
SHORT = 2;
}
HEIGHT Height = 1;
}
Is it possible to have an empty string (""
) instead of UNDEFINED
?
No, it is not. The enum name is used to generate a member in most (all?) languages, and that member is usually an identifier, and therefore needs a name. Due to how member resolution is defined for multiple enums in some languages (C++, cough), you might also want to prefix the names, so that you can have more than one UNDEFINED
.
Personally I'd be more concerned by how ambiguous, overloaded, and limiting is a height option of "tall", "short", or "undefined".