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

Support for field long names

Add voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

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

      Description

      It would be of benefit to allow for a way to define a different aliases to reference a field by then just its name value.

      The use case for this would be when you have a defined spec for communicating between two services, and within this spec fields use short names like bId. But within code you would like to reference that field as a longer, more descriptive form. Example; setBidderId/getBidderId vs setBId/getBId.

      Aliases somewhat solve this but only from a one sided approach (Read or Write) not a bidirectional (Read and Write). The only way to make aliases work in a bidirectional way would be to define two records of the same field set but with the field name and alias values swapped. Basically creating 1 record for reading data and the other for writing data.

      One option to improve this would be to expose all field aliases as getters and setters. Another would be to add another attribute to the field def such as 'as' or 'knownAs'.

      Example of option two:

      Option2.avsc
      {
          "namespace":"options",
          "type":"record",
          "name":"Bidder",
          "fields":[
              {"name":"bId", "as":"bidderId", "value":"string"}
          ]
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nerdynick Nicholas Verbeck

              Dates

              • Created:
                Updated:

                Issue deployment