Do not require ruby enum to be uppercase

This commit is contained in:
Hao Nguyen 2018-12-14 17:06:11 -08:00
parent 00b9b2303c
commit 37dbfd6c46
2 changed files with 6 additions and 23 deletions

View File

@ -1387,23 +1387,6 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
R"({"optionalNestedEnum": "FOO"})",
"optional_nested_enum: FOO");
// Enum fields with alias
RunValidJsonTest(
"EnumFieldWithAlias", REQUIRED,
R"({"optionalAliasedEnum": "ALIAS_BAZ"})",
"optional_aliased_enum: ALIAS_BAZ");
RunValidJsonTest(
"EnumFieldWithAliasUseAlias", REQUIRED,
R"({"optionalAliasedEnum": "QUX"})",
"optional_aliased_enum: ALIAS_BAZ");
RunValidJsonTest(
"EnumFieldWithAliasLowerCase", REQUIRED,
R"({"optionalAliasedEnum": "qux"})",
"optional_aliased_enum: ALIAS_BAZ");
RunValidJsonTest(
"EnumFieldWithAliasDifferentCase", REQUIRED,
R"({"optionalAliasedEnum": "bAz"})",
"optional_aliased_enum: ALIAS_BAZ");
// Enum fields with alias
RunValidJsonTest(
"EnumFieldWithAlias", REQUIRED,
R"({"optionalAliasedEnum": "ALIAS_BAZ"})",

View File

@ -697,12 +697,12 @@ VALUE build_module_from_enumdesc(EnumDescriptor* enumdesc) {
upb_enum_next(&it)) {
const char* name = upb_enum_iter_name(&it);
int32_t value = upb_enum_iter_number(&it);
if (name[0] < 'A' || name[0] > 'Z') {
rb_raise(cTypeError,
"Enum value '%s' does not start with an uppercase letter "
"as is required for Ruby constants.",
name);
}
// if (name[0] < 'A' || name[0] > 'Z') {
// rb_raise(cTypeError,
// "Enum value '%s' does not start with an uppercase letter "
// "as is required for Ruby constants.",
// name);
// }
rb_define_const(mod, name, INT2NUM(value));
}