I'd like to define my web service API response in terms of an Avro schema. I've been reading this documentation: http://avro.apache.org/docs/current/spec.html#schemas. My issue is that I am very new to Avro and am not confident that the schema I am defining in fact matches my intended schema.
I would like to be able to validate the schema. Is there a way for me to take my schema and also a JSON output string from my API and validate that the output matches the schema?
On 03/25/2011 10:34 AM, Aurora Skarra-Gallagher wrote:
> I would like to be able to validate the schema. Is there a way for me to
> take my schema and also a JSON output string from my API and validate
> that the output matches the schema?
I don't know of an explicit command-line validator, but you might use
some of the other command line tools for this purpose.
For example, the 'jsontofrag' tool takes a schema and a JSON-encoded
datum and generates a binary-encoded datum. And the 'fragtojson' takes
a binary-encoded datum and a schema and produces a JSON-encoded datum.
You could pipe these together and check that the output looks like the