You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by GitBox <gi...@apache.org> on 2020/04/26 12:02:15 UTC

[GitHub] [avro] tjwp commented on a change in pull request #855: AVRO-2800 validate enum symbol values

tjwp commented on a change in pull request #855:
URL: https://github.com/apache/avro/pull/855#discussion_r415292937



##########
File path: lang/ruby/test/test_schema.rb
##########
@@ -541,4 +541,33 @@ def test_bytes_schema
     schema_str = 'bytes'
     assert_equal schema_str, schema.to_avro
   end
+
+  def test_validate_duplicate_symbols
+    exception = assert_raise(Avro::SchemaParseError) do
+      hash_to_schema(
+        type: 'enum',
+        name: 'name',
+        symbols: ['erica', 'erica']
+      )
+    end
+    assert_equal(
+      'Duplicate symbol: ["erica", "erica"]',
+      exception.to_s
+    )
+  end
+
+  def test_validate_enum_symbols
+    exception = assert_raise(Avro::SchemaParseError) do
+      hash_to_schema(
+        type: 'enum',
+        name: 'operator_enum',
+        symbols: ['==', '>=']

Review comment:
       Consider including an example that has a hyphen ("-")? That is probably the most common invalid example. Also, a value beginning with a digit?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org