You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Yaniv Rubinpur (Jira)" <ji...@apache.org> on 2022/01/17 22:55:00 UTC

[jira] [Commented] (AVRO-2211) SchemaBuilder equivalent or other means of schema creation

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

Yaniv Rubinpur commented on AVRO-2211:
--------------------------------------

It's quite hard to work with GenericRecord. Especially when you want to serialize it. For example, I read data from DB (using IDataReader) and try to serialize it to Json. I don't know the schema in compile time. To create GenericRecord I need to create Schema. But my only wait is to look at the IDataReader schema create 'string' schema and then parse it to create the Schema object. It would be much nicer if I could create the schema object directly. I think that changing the constructors of the schema classes (like RecordSchema) to public will be the way to go.

 

Java allows creation of those schema object using factory method for each schema type on the Schema class itself. 

 

For example:

public static Schema createRecord(String name, String doc, String namespace, boolean isError, List<Field> fields) 

 

But I think it's more SOLID to just make the constructors public

A builder class like in Java would be great extra. 

 

> SchemaBuilder equivalent or other means of schema creation
> ----------------------------------------------------------
>
>                 Key: AVRO-2211
>                 URL: https://issues.apache.org/jira/browse/AVRO-2211
>             Project: Apache Avro
>          Issue Type: Wish
>          Components: csharp
>            Reporter: Dan Stelljes
>            Priority: Major
>
> Currently, the only way to create a schema is via the Schema.Parse method. We'd like to be able to build a schema programmatically—would it be possible to (1) introduce an analogue to the SchemaBuilder from the Java library or (2) expose constructors on Schema and its descendants?
> Would be more than happy to contribute work on this given some direction.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)