Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

(2.8) default value not supported #34

Closed
turbospaces opened this issue Feb 10, 2016 · 4 comments
Closed

(2.8) default value not supported #34

turbospaces opened this issue Feb 10, 2016 · 4 comments

Comments

@turbospaces
Copy link

Right now RecordVisitor create Fields without default VALUE, which causes problem when the schema evaluates and client operates with OLD data http://ben-tech.blogspot.com/2013/05/avro-schema-evolution.html

I suggest to change Record visitor to:

@Override
public void optionalProperty(BeanProperty writer) throws JsonMappingException {
  Schema schema = schemaForWriter( writer );
  if ( !writer.getType().isPrimitive() ) {
      schema = AvroSchemaHelper.unionWithNull( schema );
  }
    _fields.add( new Schema.Field( writer.getName(), schema, null,
       writer.isRequired() ? null : Schema.parseJson( "null" ) ) );
}
@cowtowncoder cowtowncoder changed the title default value not supported (2.8) default value not supported Mar 17, 2016
@cowtowncoder
Copy link
Member

I am not against this, although in a way it would be nice to have some way to indicate need for default values.

Due to potential backwards compatibility concerns I think it is safest to add this in 2.8.

@turbospaces
Copy link
Author

any plans to add support for default values? when this can be implemented?

@cowtowncoder
Copy link
Member

@turbospaces I haven't had time to work on this. To get code changed, a unit test would be needed to show problem being solved; a PR would be great.

@cowtowncoder
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants