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:49:00 UTC

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

     [ https://issues.apache.org/jira/browse/AVRO-2518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kyle Boyer updated AVRO-2518:
-----------------------------
    Description: 
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/618

  was:
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


> 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
>            Priority: Major
>              Labels: easyfix, pull-request-available, test
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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/618



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