Biliuta created AVRO-2934:
-----------------------------

             Summary: Initialise all fields in a nested schema
                 Key: AVRO-2934
                 URL: https://issues.apache.org/jira/browse/AVRO-2934
             Project: Apache Avro
          Issue Type: Improvement
          Components: java
            Reporter: Biliuta


For testing purposes it would be nice to have a way to initialise all fields to 
some value even if there is no default value specified in the schema. I noticed 
that for schemas that are large and have a few levels of nesting it can get 
quite ugly (creating all the required sub classes) when you want to instantiate 
a random message to do some tests.

The possible data types in an avro schema are initialisable to some 
default/random value and if this is not the value desired, it can be changed at 
any time.

I did a short implementation using reflection that recursively goes through the 
entire fields of a message  but maybe an annotation included in the avro schema 
(using javaAnnotation) would make more sense so that it is available only if 
needed. The annotation could also include some options like default or random 
value, overwrite existing non null members or not, ignore specific members or 
types.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to