[
https://issues.apache.org/jira/browse/AVRO-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865896#comment-15865896
]
Tim Perkins commented on AVRO-1886:
-----------------------------------
The problem seems to be dependent on the version of test-unit used. [~sacharya]
used test-unit 2.1.0.5 (July 2010) which displays the issue:
{code}
$ ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin15.0]
$ bundle show test-unit
/Users/tim/.rvm/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/test-unit-2.1.5.0
$ RUBYOPT="-W0" bundle exec rake test
/Users/tim/.rvm/rubies/ruby-2.1.5/bin/ruby -w -I"lib:ext:bin:test"
-I"/Users/tim/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib"
"/Users/tim/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/rake_test_loader.rb"
"test/test_datafile.rb" "test/test_fingerprints.rb" "test/test_help.rb"
"test/test_io.rb" "test/test_protocol.rb" "test/test_schema.rb"
"test/test_schema_normalization.rb" "test/test_schema_validator.rb"
"test/test_socket_transport.rb"
# individual error output omitted
Finished tests in 0.366456s, 226.4938 tests/s, 2546.0083 assertions/s.
83 tests, 933 assertions, 11 failures, 0 errors, 0 skips
ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin15.0]
rake aborted!
{code}
The latest version of test-unit 3.2.3 (Nov 2016) does not:
{code}
$ ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin15.0]
$ bundle show test-unit
/Users/tim/.rvm/gems/ruby-2.1.5/gems/test-unit-3.2.3
$ RUBYOPT="-W0" bundle exec rake test
/Users/tim/.rvm/rubies/ruby-2.1.5/bin/ruby -w -I"lib:ext:bin:test"
-I"/Users/tim/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib"
"/Users/tim/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/rake_test_loader.rb"
"test/test_datafile.rb" "test/test_fingerprints.rb" "test/test_help.rb"
"test/test_io.rb" "test/test_protocol.rb" "test/test_schema.rb"
"test/test_schema_normalization.rb" "test/test_schema_validator.rb"
"test/test_socket_transport.rb"
Loaded suite
/Users/tim/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/rake_test_loader
Started
...................................................................................
Finished in 0.450729 seconds.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
83 tests, 945 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0
notifications
100% passed
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
184.15 tests/s, 2096.60 assertions/s
{code}
> Improve error reporting for schema validation
> ---------------------------------------------
>
> Key: AVRO-1886
> URL: https://issues.apache.org/jira/browse/AVRO-1886
> Project: Avro
> Issue Type: Improvement
> Components: ruby
> Reporter: Miroslav Csonka
> Assignee: Miroslav Csonka
> Fix For: 1.9.0, 1.8.2
>
>
> In Funding Circle we use avro schema to validate some financial data and
> we've found ourselves wondering what is invalid. We've noticed that avro
> [does already
> validation|https://github.com/apache/avro/blob/master/lang/ruby/lib/avro/schema.rb#L94],
> but does not report what fields are invalid, so we've decided to change it
> and we use Avro as a validation library.
> h5. What error messages to expect?
> We communicate errors for a given payload in format "at <path> <expected>
> <received>".
> For <path> we've decided to use syntax similar to json path:
> * . refers to root
> * \[0\] first index in array
> * .age would match 42 from {"age": 42}
> Error within object *person* and his optional array *houses* on *second item*
> with key *number_of_rooms*:
> {quote}
> at .person.houses\[1\].number_of_rooms expected type long, got string
> with value "not valid at all"
> {quote}
> Example of multiple errors for a single payload:
> {quote}
> at .\[0\] expected type int, got null
> at .\[1\] expected type int, got string with value \"e\"
> {quote}
> More examples can be seen at
> https://github.com/apache/avro/pull/111/files#diff-830ac80276854fceefa3f92c346d165f
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)