[ 
https://issues.apache.org/jira/browse/AVRO-1325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13659923#comment-13659923
 ] 

Scott Carey commented on AVRO-1325:
-----------------------------------

The field syntax could have shortcuts too -- since the FieldsBuilder currently 
has only two methods (name() and endRecord()), we could add a few shortcut 
methods for the most common use cases.

{quote}
Why have type() and type(Schema)?
{quote}
{code}
Schema person = new Schema.Parser().parse(Person.avsc);  // or lookup from 
schema repo

Schema job = new SchemaBuilder.record("Job").fields()
  .name("title").type().stringType().noDefault()
  .name("who").type(person).noDefault()
  .endRecord();

Schema meeting = new SchemaBuilder.record("Meeting").fields()
  .name("location").type().stringType().noDefault()
  .name("attendees").type().array().items(person).noDefault()
  .endRecord();
{code}


{quote}Error type is missing, but this can be easily added.{quote}  
I wondered what to do here, since Error is for Protocols only, perhaps add it 
when we add a ProtocolBuilder or extend SchemaBuilder to support protocols?
                
> Enhanced Schema Builder API
> ---------------------------
>
>                 Key: AVRO-1325
>                 URL: https://issues.apache.org/jira/browse/AVRO-1325
>             Project: Avro
>          Issue Type: Bug
>            Reporter: Scott Carey
>            Assignee: Scott Carey
>             Fix For: 1.7.5
>
>         Attachments: AVRO-1325.patch, AVRO-1325-preliminary.patch, 
> AVRO-1325-properties.patch, AVRO-1325-v2.patch
>
>
> The schema builder from AVRO-1274 has a few key limitations.  I have proposed 
> changes to make before it is released and the public API is locked in.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to