Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1886

Improve error reporting for schema validation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.9.0
    • ruby
    • None

    Description

      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, but does not report what fields are invalid, so we've decided to change it and we use Avro as a validation library.

      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:

      at .person.houses[1].number_of_rooms expected type long, got string with value "not valid at all"

      Example of multiple errors for a single payload:

      at .[0] expected type int, got null
      at .[1] expected type int, got string with value \"e\"

      More examples can be seen at https://github.com/apache/avro/pull/111/files#diff-830ac80276854fceefa3f92c346d165f

      Attachments

        Issue Links

          Activity

            People

              MiroslavCsonka Miroslav Csonka
              MiroslavCsonka Miroslav Csonka
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: