Hi,
My immediate thought, if preserving backward-compatibility is a concern, is
to specify that the current rule applies recursively.
That is where the spec says: "Default values for union fields correspond to
the first schema in the union", we'd say:
"Default values for union fields (and any union values within the field)
correspond to the first schema in the union".
Then you don't need any complex ambiguity rules.
cheers,
rog.
On Tue, 24 Mar 2020 at 09:29, Andy Le <[email protected]> wrote:
> Hi Roger,
>
> I'm thinking of reading again Avro Spec and writing down some
> dis-ambiguity rules. Suggested rule above for enums is one of them. It
> would be great if you can provide me other ones.
>
> To me, using rules is the most affordable way to keep compatibilities.
>
> If you care, please check my fork https://github.com/anhldbk/avro
>
> Thank you.
>
> On 2020/03/23 17:51:19, roger peppe <[email protected]> wrote:
> > On Mon, 23 Mar 2020 at 11:11, Andy Le <[email protected]> wrote:
> >
> > > I may say:
> > >
> > > If enums are used in a Union, they must NOT use the same symbols
> > >
> > > Is that OK, Roger?
> > >
> >
> > I'm not sure that it is OK. The problem is wider than just enums -
> > AFAICS it applies to record and fixed types too, because they're named
> > types - more than one of a record or fixed type is allowed in a union,
> but
> > the default-value representation doesn't allow distinguishing between
> them.
> >
> > The ideal solution coming from a fresh start would be to use exactly the
> > same representation for default values as for the JSON encoding, but I
> > appreciate that backward-compatibility concerns would make that difficult
> > or impossible to do.
> >
> >
> >
> > > On 2020/03/23 09:44:45, roger peppe <[email protected]> wrote:
> > > > On Sun, 22 Mar 2020 at 09:09, Andy Le <[email protected]> wrote:
> > > >
> > > > > Hi Roger,
> > > > >
> > > > > Instead of trying to modify the spec, is it easier for us to
> discard
> > > > > schemas with such ambiguity?
> > > > >
> > > > > That certainly sounds like a reasonable approach to me. How would
> you
> > > word
> > > > the definition of ambiguity for this purpose?
> > > >
> > >
> >
>