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

Ruby schema validation for fixed types should use bytesize in error message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.9.0
    • 1.9.0
    • ruby
    • None

    Description

      From AVRO-1886:

      I'd like to get one thing improved, but it's fine as a follow-on.

       +       when :fixed
       +          if datum.is_a? String
       +            message = "expected fixed with size #{expected_schema.size}, got \"#{datum}\" with size #{datum.size}"
       +            result.add_error(path, message) unless datum.bytesize == expected_schema.size
       +          else
       +            result.add_error(path, "expected fixed with size #{expected_schema.size}, got #{actual_value_message(datum)}")
       +          end
      

      the message here should use datum.bytesize instead of datum.size.

      Attachments

        1. AVRO-1989.0.patch
          1 kB
          Sean Busbey

        Issue Links

          Activity

            People

              fokko Fokko Driesprong
              busbey Sean Busbey
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: