Java Code Examples for org.apache.avro.Schema.Parser#setValidateDefaults()

The following examples show how to use org.apache.avro.Schema.Parser#setValidateDefaults() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchemaDeserializer.java    From data-highway with Apache License 2.0 5 votes vote down vote up
@Override
public Schema deserialize(JsonParser parser, DeserializationContext context)
  throws IOException, JsonProcessingException {
  Parser schemaParser = new Schema.Parser();
  // Validate any default values provided
  schemaParser.setValidateDefaults(true);
  // Validate all names.
  schemaParser.setValidate(true);
  return schemaParser.parse(parser.readValueAsTree().toString());
}
 
Example 2
Source File: StructSchema.java    From pulsar with Apache License 2.0 4 votes vote down vote up
protected static org.apache.avro.Schema parseAvroSchema(String schemaJson) {
    final Parser parser = new Parser();
    parser.setValidateDefaults(false);
    return parser.parse(schemaJson);
}