[
https://issues.apache.org/jira/browse/AVRO-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12854312#action_12854312
]
Eric Evans commented on AVRO-494:
---------------------------------
The parser was written to handle arbitrary attributes using the @identifer
annotation, but this isn't working as expected; it's actually adding them as
properties to the attributes type object.
So in other words you end up with:
{noformat}
{name: aname, type: {type: string, order: ignore}}
{noformat}
... instead of:
{noformat}
{name: aname, type: string, order: ignore}
{noformat}
The patch attached here parses the attributes for default and order into
JsonNode and Field.Order instances respectively and passes them into the Field
constructor. There is probably a better way. For example, this requires you to
supply an attribute that parses as valid JSON. For example:
{noformat}
record FooRecord {
@default(false)
boolean yesno;
@default(100)
int number;
/* Fails; parses to the bareword ignore */
@order("ignore")
string badstring;
/* Succeeds; parses to "ignore" */
@order("\"ignore\"")
string goodstring;
}
{noformat}
Thoughts?
> the genavro format should support defaults
> ------------------------------------------
>
> Key: AVRO-494
> URL: https://issues.apache.org/jira/browse/AVRO-494
> Project: Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.3.2
> Reporter: Eric Evans
> Priority: Minor
> Attachments:
> v1-0001-AVRO-494.-teach-genavro-about-defaults-and-fix-order.txt
>
>
> It would be great if the genavro format also supported assigning default
> values.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.