[
https://issues.apache.org/jira/browse/AVRO-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tom White updated AVRO-1274:
----------------------------
Attachment: AVRO-1274.patch
Here's a start. An example of the API:
{noformat}
Schema schema = SchemaBuilder
.recordType().name("myrecord").aliases("oldrecord")
.field().name("f0").type(SchemaBuilder.STRING)
.field().name("f1").type(SchemaBuilder.LONG)
.field().name("f2").type(SchemaBuilder.BOOLEAN).optional()
.build();
{noformat}
* I called the class SchemaBuilder, but perhaps it should be Schema.Builder by
analogy with Schema.Parser.
* There's no support for default values for fields. I had a cursory look but
couldn't see a way to convert from Java objects to JsonNodes in the current
code - is there a way to do that?
* I still have to add javadoc and a few more tests.
> Add a schema builder API
> ------------------------
>
> Key: AVRO-1274
> URL: https://issues.apache.org/jira/browse/AVRO-1274
> Project: Avro
> Issue Type: New Feature
> Components: java
> Reporter: Tom White
> Assignee: Tom White
> Attachments: AVRO-1274.patch
>
>
> It would be nice to have a fluent API that made it easier to construct record
> schemas.
--
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