You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Kyle Boyer (Jira)" <ji...@apache.org> on 2019/08/22 19:36:00 UTC

[jira] [Created] (AVRO-2518) Ruby Avro doesn't validate enum fields with default values

Kyle Boyer created AVRO-2518:
--------------------------------

             Summary: Ruby Avro doesn't validate enum fields with default values
                 Key: AVRO-2518
                 URL: https://issues.apache.org/jira/browse/AVRO-2518
             Project: Apache Avro
          Issue Type: Bug
          Components: ruby
    Affects Versions: 1.9.0
         Environment: Centos 7 Docker - ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-musl]

Mac OS X 10.14.X - ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
            Reporter: Kyle Boyer


As of Avro 1.9, the [specification|https://avro.apache.org/docs/1.9.0/spec.html#Enums] states that Enums can have a default value. With the following schema(or similar schemas having enum fields with default values):
{code:json}
{
  "type": "record",
  "name": "enum_field_default",
  "fields": [
    {
      "name": "msg",
      "type": "string"
    },
    {
      "name": "logClass",
      "type": {
        "type": "enum",
        "name": "logClass",
        "symbols": [
          "UNCATEGORIZED",
          "E1",
          "E2",
          "E3",
          "E4",
          "E5",
          "E6",
          "E7",
          "E8",
          "E9",
          "E10"
        ]
      },
      "default": "UNCATEGORIZED"
    }
  ]
}
{code} 

We are unable to validate this message using Ruby Avro 1.9, however it works fine using Java Avro 1.9: 
{code:json}
{"msg": "boom"}
{code}

A draft PR has been created to fix this issue: https://github.com/apache/avro/pull/614



--
This message was sent by Atlassian Jira
(v8.3.2#803003)