Let me correct. Not "alias", but "aliases". {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum"," >> type":{"type":"enum","name":"exampleEnum","alias":"1 > > bad alias","symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1 > bad alias"}]} >
{"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum"," type":{"type":"enum","name":"exampleEnum","aliases":["1 bad alias"],"symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1 bad alias"}]} {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum","type":{"type":"enum","name":"exampleEnum","alias":"1bad > alias.foo.bar","symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1bad > alias.foo.bar"}]} {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum","type":{"type":"enum","name":"exampleEnum","aliases":["1bad alias.foo.bar"],"symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1bad alias.foo.bar"}]} 2023年8月18日(金) 15:37 Kousuke Saruta <saru...@apache.org>: > Hi Michael, > > >> {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum","type":{"type":"enum","name":"exampleEnum","alias":"1 >> bad alias","symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1 >> bad alias"}]} >> > > In the current Java binding, the namespace portion in an alias is accepted > without validation. > So, the following schema is acceptable. > > {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum","type":{"type":"enum","name":"exampleEnum","alias":"1bad > alias.foo.bar","symbols":["A","B","C"]}},{"name":"anotherEnum","type":"exampleEnum"}]} > > I'm discussing namespace in this thread, so this behavior seems O.K to me. > > But reference to another named types is not implemented for the Java > binding. > So the following schema is not accepted. > > {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum","type":{"type":"enum","name":"exampleEnum","alias":"1bad > alias.foo.bar","symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1bad > alias.foo.bar"}]} > > I have a plan to fix it. > > 2023年8月18日(金) 11:33 Michael A. Smith <mich...@smith-li.com>: > >> I found I'm still a little confused at how using aliases to correct >> invalid names should work. Maybe you can define an alias that is an >> invalid name, but having done so, can you use it? I tried this schema >> in both the Python and Java implementations. >> >> >> {"type":"record","name":"AliasReferenceExample","fields":[{"name":"anEnum","type":{"type":"enum","name":"exampleEnum","alias":"1 >> bad alias","symbols":["A","B","C"]}},{"name":"anotherEnum","type":"1 >> bad alias"}]} >> >> I expected it to error in Python, because I know Python requires valid >> names for aliases. But Java also errored with "schema failed: Illegal >> initial character: 1 bad alias". I am not sure if the error is from >> the alias definition or its use. >> >> If my example is flawed, can someone supply a correct one? >> >> On Thu, Aug 17, 2023 at 4:53 AM Oscar Westra van Holthe - Kind >> <os...@westravanholthe.nl> wrote: >> > >> > On Mon, 14 Aug 2023 at 14:11, Ryan Skraba <r...@skraba.com> wrote: >> > >> > > I think the right thing to do is [to] use a system >> > > property / schema aliases to help people migrate back to the correct >> > > behaviour. If you are actually using Avro/Protobuf together, you >> > > might be the best person to help us figure out the right was to do >> > > this migration! >> > > >> > >> > The idea that aliases can be used to evolve a schema with invalid names >> to >> > a schema with valid names is a sensible one, and currently hidden in the >> > schema resolution rules in the specification. >> > >> > I've added AVRO-3833 <https://issues.apache.org/jira/browse/AVRO-3833> >> (with >> > PR <https://github.com/apache/avro/pull/2448>) because I wanted to >> clarify >> > that names must >> > be unique (because otherwise schema resolution cannot work), and that >> this >> > includes aliases. The change also includes this migration/fix option. >> > >> > Kind regards, >> > Oscar >> > >> > -- >> > ✉️ Oscar Westra van Holthe - Kind <os...@westravanholthe.nl> >> >