Hi,

I'm reading the spec about aliases 
https://avro.apache.org/docs/1.12.0/specification/#aliases
And specifically, this part

Aliases are alternative names, and thus subject to the same uniqueness 
constraints as names.
Aliases should be valid names, but this is not required: any string is accepted 
as an alias.

My goal is to use aliases to allow the dash (-) character:
Suppose I have a field with
"symbols": ["Not_Handled", "Handled"]
"aliases": ["Not-Handled", "Handled"]

To me, it looks correct regarding the specifications.
At least, I can upload such schema into a schema registry without any error.

But when I decode it using the avro java library, I have:
2025-05-15 07:58:13 [main] ERROR Error occurred while fetching schema my_schema
org.apache.avro.SchemaParseException: Illegal character in: Not-Handled
               at org.apache.avro.Schema.validateName(Schema.java:1693) 
~[avro-1.12.0.jar:1.12.0]
               at org.apache.avro.Schema$Name.<init>(Schema.java:730) 
~[avro-1.12.0.jar:1.12.0]
               at org.apache.avro.Schema$NamedSchema.addAlias(Schema.java:846) 
~[avro-1.12.0.jar:1.12.0]
               at org.apache.avro.Schema$NamedSchema.addAlias(Schema.java:837) 
~[avro-1.12.0.jar:1.12.0]
               at org.apache.avro.Schema.parseAliases(Schema.java:2003) 
~[avro-1.12.0.jar:1.12.0]
               at org.apache.avro.Schema.parseEnum(Schema.java:1929) 
~[avro-1.12.0.jar:1.12.0]
               at org.apache.avro.Schema.parse(Schema.java:1837) 
~[avro-1.12.0.jar:1.12.0]

Is this a bug ? Or am I misinterpreting the spec ?

Thanx,
Christophe.


Reply via email to