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() { ...@@ -1387,23 +1387,6 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
R"({"optionalNestedEnum": "FOO"})", R"({"optionalNestedEnum": "FOO"})",
"optional_nested_enum: FOO"); "optional_nested_enum: FOO");
// Enum fields with alias // 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( RunValidJsonTest(
"EnumFieldWithAlias", REQUIRED, "EnumFieldWithAlias", REQUIRED,
R"({"optionalAliasedEnum": "ALIAS_BAZ"})", R"({"optionalAliasedEnum": "ALIAS_BAZ"})",
......
...@@ -697,12 +697,12 @@ VALUE build_module_from_enumdesc(EnumDescriptor* enumdesc) { ...@@ -697,12 +697,12 @@ VALUE build_module_from_enumdesc(EnumDescriptor* enumdesc) {
upb_enum_next(&it)) { upb_enum_next(&it)) {
const char* name = upb_enum_iter_name(&it); const char* name = upb_enum_iter_name(&it);
int32_t value = upb_enum_iter_number(&it); int32_t value = upb_enum_iter_number(&it);
if (name[0] < 'A' || name[0] > 'Z') { // if (name[0] < 'A' || name[0] > 'Z') {
rb_raise(cTypeError, // rb_raise(cTypeError,
"Enum value '%s' does not start with an uppercase letter " // "Enum value '%s' does not start with an uppercase letter "
"as is required for Ruby constants.", // "as is required for Ruby constants.",
name); // name);
} // }
rb_define_const(mod, name, INT2NUM(value)); 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