Chris Hoffman created AVRO-2713:
-----------------------------------
Summary: Longs & Ints in Unions don't receive Out-of-Bounds
validation messages
Key: AVRO-2713
URL: https://issues.apache.org/jira/browse/AVRO-2713
Project: Apache Avro
Issue Type: Bug
Components: ruby
Environment: Avro 1.9.1
Ruby 2.4.4, though this will apply to all Rubies, since it's a logic issue.
Reporter: Chris Hoffman
The validation messages displayed to users change if an Int or Long type is in
a Union.
In this case, it changes from one that could actually help resolve the
validation issue to one that won't.
{code:java}
[1] pry(main)> require 'avro'
=> true
[2] pry(main)> Avro::SchemaValidator.validate!(Avro::Schema.parse({
[2] pry(main)* type: :record,
[2] pry(main)* name: :thingy,
[2] pry(main)* fields: [{
[2] pry(main)* name: :number,
[2] pry(main)* type: :long
[2] pry(main)* }]
[2] pry(main)* }.to_json), {"number" => 9999999999999999999})
Avro::SchemaValidator::ValidationError: at .number out of bound value
9999999999999999999
from
/home/chrishoffman/.asdf/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/avro-1.9.1/lib/avro/schema_validator.rb:76:in
`validate!'
[3] pry(main)> Avro::SchemaValidator.validate!(Avro::Schema.parse({
[3] pry(main)* type: :record,
[3] pry(main)* name: :thingy,
[3] pry(main)* fields: [{
[3] pry(main)* name: :number,
[3] pry(main)* type: [:null, :long]
[3] pry(main)* }]
[3] pry(main)* }.to_json), {"number" => 9999999999999999999})
Avro::SchemaValidator::ValidationError: at .number expected union of ['null',
'long'], got long with value 9999999999999999999
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)