Tyler Harwood created AVRO-4173: ----------------------------------- Summary: [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: js Reporter: Tyler Harwood
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)