Given this proto definition:
enum Category {
NOT_SPECIFIED = 0;
LISTINGS = 1;
REPUTATION = 2;
}
The C++ JSON parser should only accept "LISTINGS" as enum field values, but right now it accepts "listings" (converted to lower-case) as well.
For enum fields, proto3 JSON spec says "The name of the enum value as specified in proto is used":
https://developers.google.com/protocol-buffers/docs/proto3#json
"as specified in proto" should be interpreted as "the exactly same name including casing as specified in proto".
Apparently C++ JSON parser not only accepts lower-case enum value names, but actually accepts arbitrary casing like "Listings" or "LiStInGs"...
Well, that only works if the enum name is defined all upper case. If the enum is defined as:
enum Category {
NotSpecified = 0;
Listings = 1;
Reputation = 2;
}
Neither "listings" nor "LISTINGS" will be accepted... With the above definition, only "Listings" works.
Most helpful comment
Well, that only works if the enum name is defined all upper case. If the enum is defined as:
Neither "listings" nor "LISTINGS" will be accepted... With the above definition, only "Listings" works.