avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Lantos (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (AVRO-1886) Improve error reporting for schema validation
Date Tue, 14 Feb 2017 11:59:42 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865660#comment-15865660
] 

David Lantos edited comment on AVRO-1886 at 2/14/17 11:58 AM:
--------------------------------------------------------------

It does seem to be 2.1 related:

On 2.3.3 I get 0 failures:

{code}
83 tests, 945 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
{code}

On 2.4.0 I get three failures:

{code}
83 tests, 939 assertions, 3 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
96.3855% passed

  expected 'at . expected type boolean, got int with value 1' to be in '["at . expected type
boolean, got long with value 1"]'.
  expected 'at .fruits expected type array, got int with value 1' to be in '["at .fruits expected
type array, got long with value 1"]'.
  expected 'at . expected type null, got int with value 1' to be in '["at . expected type
null, got long with value 1"]'.
{code}

They all seem to be related to {{1}} being {{long}}, not {{int}} as the spec expects -- but
that is expected due to [Fixnum-Integer changes in 2.4|https://blog.heroku.com/ruby-2-4-features-hashes-integers-rounding#fixnum-by-ruby].


was (Author: sldblog):
It does seem to be 2.1 related:

On 2.3.3 I get 0 failures:

{code}
Finished in 0.526283 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
83 tests, 945 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
157.71 tests/s, 1795.61 assertions/s
{code}

On 2.4.0 I get three failures:

{code}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
83 tests, 939 assertions, 3 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
96.3855% passed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
164.37 tests/s, 1859.58 assertions/s

  expected 'at . expected type boolean, got int with value 1' to be in '["at . expected type
boolean, got long with value 1"]'.
  expected 'at .fruits expected type array, got int with value 1' to be in '["at .fruits expected
type array, got long with value 1"]'.
  expected 'at . expected type null, got int with value 1' to be in '["at . expected type
null, got long with value 1"]'.
{code}

They all seem to be related to {{1}} being {{long}}, not {{int}} as the spec expects -- but
that is expected due to [Fixnum-Integer changes in 2.4|https://blog.heroku.com/ruby-2-4-features-hashes-integers-rounding#fixnum-by-ruby].

> 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)

Mime
View raw message