Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2638

IDL: Inconsistent field annotation behaviour

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.8.2
    • Fix Version/s: None
    • Component/s: spec
    • Labels:
      None

      Description

      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:

      @myannotation
      string my_field;
      

      However, in the case of a union field type, myannotation is not interpreted as a field annotation:

      @myannotation
      { null, string } my_field;
      

      Instead, for the union case, one must declare the annotation between the field type and name, for it to be attributed to the field:

      { null, string }
      @myannotation
      my_field;
      

      It is not clear to me from the documentation 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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              teabot Elliot West
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: