You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Tim Perkins (Jira)" <ji...@apache.org> on 2019/08/28 12:18:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16917722#comment-16917722 ]
Tim Perkins commented on AVRO-2518:
-----------------------------------
I don't think this is a bug.
Field defaults are for use by the reader if a field is missing.
It is possible that the implementation varies by language, but I think that Ruby is conforming to the specification here.
> 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
> Attachments: 0001-AVRO-2518-Add-enum-field-with-default-value-test.patch, 0002-AVRO-2518-Validate-enum-field-with-default-values.patch
>
> 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 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)