Fixing Christophe's email (removed .invalid) On Fri, May 16, 2025 at 1:08 PM Martin Grigorov <mgrigo...@apache.org> wrote:
> Hi, > > I could tell for the Rust SDK: > 1) aliases are validated as names > 2) the application could set a custom validator via > apache_avro::validator::set_schema_name_validator(...). It will be used > for both names and aliases > > In the Java SDK you could use > https://github.com/apache/avro/blob/80cebcfbae3425ea555ff8ddd17e9102b7f88e55/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1703 > but it is deprecated ... > > On Thu, May 15, 2025 at 11:50 AM Anzile, Christophe > <christophe.anz...@hpe.com.invalid> wrote: > >> 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. >> >> >>