-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Root Cause
The canAssignVMType function in analyze.go does not handle the case where a union contains
a recursive/self-referencing record type. When NestedProperty references itself inside
the union's value type, the analyzer encounters a nil pointer because the type has not
been fully resolved yet during the schema tree walk.
Key Details
- The schema is valid per the Avro specification. Recursive types via named references are
explicitly allowed. - The panic occurs during schema parsing (ParseType), not during marshal/unmarshal.
- The panic occurs regardless of the Go target struct — even if the Go struct has no
corresponding field for the problematic schema field, the full schema tree is still
analyzed. - Schemas with simple unions (e.g., ["null", "string"]) or non-recursive records work
fine. The issue is specifically with recursive named type references inside multi-branch
unions.
Expected Behavior
avro.ParseType() should either:
- Successfully parse the schema and handle recursive type references during analysis, OR
- Return an error describing the unsupported pattern (instead of panicking)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels