[ 
https://issues.apache.org/jira/browse/AVRO-3809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Vinci updated AVRO-3809:
-------------------------------
    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._}}

 
{code:json}
{
            "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" }
                  ]
                }
              }
            ]
          }
{code}

  was:
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


{code:json}
{
            "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" }
                  ]
                }
              }
            ]
          }
{code}



> Faulty validation of a type reference with implicit nested namespace
> --------------------------------------------------------------------
>
>                 Key: AVRO-3809
>                 URL: https://issues.apache.org/jira/browse/AVRO-3809
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: rust
>            Reporter: Andrea Vinci
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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._}}
>  
> {code:json}
> {
>             "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" }
>                   ]
>                 }
>               }
>             ]
>           }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to