Nicholas Verbeck created AVRO-1631:
--------------------------------------
Summary: Support for field long names
Key: AVRO-1631
URL: https://issues.apache.org/jira/browse/AVRO-1631
Project: Avro
Issue Type: Improvement
Reporter: Nicholas 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
(v6.3.4#6332)