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

Faulty validation of a type reference with implicit nested namespace

    XMLWordPrintableJSON

Details

    Description

      The validate_internal function is not propagating schema's sub-namespaces resulting in validation error of valid values.

      For example, it is not possible to set a value for the following schema even though it is a valid one.

      The issue is that when Avro tries to validate the value for middle_field_2 it tries to resolve the reference inner_record_name using the top level namespace space.inner_record_name instead of middle_namespace.inner_record_name.

       

      {
                  "name": "record_name",
                  "namespace": "space",
                  "type": "record",
                  "fields": [
                    {
                      "name": "outer_field_1",
                      "type": {
                        "type": "record",
                        "name": "middle_record_name",
                        "namespace": "middle_namespace",
                        "fields": [
                          {
                            "name": "middle_field_1",
                            "type": {
                              "type": "record",
                              "name": "inner_record_name",
                              "fields": [
                                { "name": "inner_field_1", "type": "double" }
                              ]
                            }
                          },
                          { "name": "middle_field_2", "type": "inner_record_name" }
                        ]
                      }
                    }
                  ]
                }
      

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              andrewinci Andrea Vinci
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m