[ 
https://issues.apache.org/jira/browse/AVRO-4173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18032347#comment-18032347
 ] 

ASF subversion and git services commented on AVRO-4173:
-------------------------------------------------------

Commit 3160e011e5c852a5ee5e8e42f27c7a3fd24d0454 in avro's branch 
refs/heads/dependabot/maven/lang/java/org.apache.maven.plugins-maven-enforcer-plugin-3.6.2
 from tyler-blip
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=3160e011e5 ]

AVRO-4173: [js] Fix namespace inheritance for nested types in schema parsing 
(#3466)

* AVRO-4173: [JS] Fix namespace inheritance for nested types

* AVRO-4173: [JS] Refactor getOpts to prevent shared state

* Simplify registry and logicalTypes initialization

* Revert "Simplify registry and logicalTypes initialization"

This reverts commit 28fb6c0fec5077b7f0a5fc36c983fb7e1c50b18b.

---------

Co-authored-by: Martin Grigorov <[email protected]>
Co-authored-by: Martin Tzvetanov Grigorov <[email protected]>

> [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 20m
>  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