[
https://issues.apache.org/jira/browse/AVRO-2638?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Elliot West updated AVRO-2638:
------------------------------
Priority: Minor (was: Major)
> IDL: Inconsistent field annotation behaviour
> --------------------------------------------
>
> Key: AVRO-2638
> URL: https://issues.apache.org/jira/browse/AVRO-2638
> Project: Apache Avro
> Issue Type: Bug
> Components: spec
> Affects Versions: 1.8.2
> Reporter: Elliot West
> Priority: Minor
>
> The interpretation of IDL field level annotations appears to be inconsistent
> for different type structures. Specifically, if the field type is {{union}}
> the the declaration of annotations is particularly sensitive to the location
> of said annotations with respect to the type. For example:
> In this case, with a primitive field type, {{myannotation}} is interpreted as
> a field annotation:
> {code}
> @myannotation
> string my_field;
> {code}
> However, in the case of a {{union}} field type, {{myannotation}} is *not*
> interpreted as a field annotation:
> {code}
> @myannotation
> { null, string } my_field;
> {code}
> Instead, for the {{union}} case, one must declare the annotation between the
> field type and name, for it to be attributed to the field:
> {code}
> { null, string }
> @myannotation
> my_field;
> {code}
> It is not clear to me from [the
> documentation|http://avro.apache.org/docs/current/idl.html#minutiae_annotations]
> what the expected behaviour is. However, the current behaviour is not ideal
> because seemingly correct annotations silently fail to be attributed to
> fields. I would expect one of the following behaviours would be preferable:
> * Consistency: Preceding and mid-position works for all types
> * Consistency: Either preceding or mid-position works, the other should
> generate an error
> * Inconsistent but fail fast: error thrown if annotation declared preceding a
> {{union}} field type declaration
--
This message was sent by Atlassian Jira
(v8.3.4#803005)