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

Martin Tzvetanov Grigorov resolved AVRO-4173.
---------------------------------------------
    Fix Version/s: 1.13.0
         Assignee: Martin Tzvetanov Grigorov
       Resolution: Fixed

> [JavaScript] Incorrect type resolution in nested schemas
> --------------------------------------------------------
>
>                 Key: AVRO-4173
>                 URL: https://issues.apache.org/jira/browse/AVRO-4173
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: javascript, js
>            Reporter: Tyler Harwood
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.13.0
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Namespace inheritance is broken when parsing nested record types with mixed 
> explicit and inherited namespaces. This causes type resolution to fail with 
> "undefined type name" errors.
>  
> Example code to reproduce the bug:
> {code:java}
> const avro = require('avro-js');
> const schema = {
>   type: 'record',
>   name: 'Parent',
>   namespace: 'parent.ns',
>   fields: [
>     {
>       name: 'child_field',
>       type: {
>         type: 'record',
>         name: 'Child',  // No namespace - should inherit 'parent.ns'
>         fields: [{name: 'value', type: 'int'}]
>       }
>     },
>     {
>       name: 'other_field',
>       type: {
>         type: 'record', 
>         name: 'Other',
>         namespace: 'different.ns', // Explicit namespace corrupts context
>         fields: [{name: 'data', type: 'int'}]
>       }
>     },
>     {
>       name: 'reference_field',
>       type: 'Child'  // References Child - should resolve to 'parent.ns.Child'
>     }
>   ]
> };
> // This fails with "undefined type name: different.ns.Child"
> const type = avro.parse(schema);
> {code}
>  



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

Reply via email to