Skip to content

Avro2JsonSchemaProcessor

fge edited this page Mar 1, 2013 · 1 revision

Link to source code

https://github.com/fge/json-schema-processor-examples/blob/master/src/main/java/com/github/fge/avro/Avro2JsonSchemaProcessor.java

Inputs and outputs

  • Input: ValueHolder<JsonTree>.
  • Output: SchemaHolder.

What it does

This processor converts an Avro schema to a JSON Schema.

As Avro differs on some fundamental points compared to JSON Schema, the conversion is of course not 100% exact. But it can convert each and every Avro schema as long as it is standalone.

As the output is a SchemaHolder, it means that with a little work, you can chain this processor to validate JSON inputs directly from an Avro schema!

Software used

The Avro Java library is used to parse Avro schemas. Conversion is self-contained.