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>

Reply via email to