You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org> on 2018/12/30 05:35:00 UTC

[jira] [Updated] (AVRO-1631) Support for field long names

     [ https://issues.apache.org/jira/browse/AVRO-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-1631:
--------------------------------------
    Component/s: spec

> Support for field long names
> ----------------------------
>
>                 Key: AVRO-1631
>                 URL: https://issues.apache.org/jira/browse/AVRO-1631
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: spec
>            Reporter: Nikoleta Verbeck
>            Priority: Minor
>
> 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:
> {code:title=Option2.avsc}
> {
>     "namespace":"options",
>     "type":"record",
>     "name":"Bidder",
>     "fields":[
>         {"name":"bId", "as":"bidderId", "value":"string"}
>     ]
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)