Commit 37dbfd6c authored by Hao Nguyen's avatar Hao Nguyen

Do not require ruby enum to be uppercase

parent 00b9b230
......@@ -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"})",
......
......@@ -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));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment