Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Experiment: a JSON Schema describing Avro schemas


Copy link to this message
-
Re: Experiment: a JSON Schema describing Avro schemas
On Fri, Feb 22, 2013 at 11:12 PM, Doug Cutting <[EMAIL PROTECTED]> wrote:
[...]
>
>>>  - a schema can be the name of a schema defined earlier, e.g.
>>> {"type":"record", "name":"List", "fields":[{"name":"next",
>>> "type":[null, "List"]}]}
>>>
>>
>> I don't believe the schema forbids that at this point but I guess I'll
>> have to check..
>
> No, but you permit any string as a schema, rather than just primitives
> and names.
>

Yes, that is true. But on the other hand, JSON Schema does structural
validation, actual functional checks are still the role of the
application to do. And that also stands for JSON Schemas themselves
since you can have a "dangling" JSON Reference for instance -- you
cannot know unless you try and dereference it.

> A list of schemas to test this on in Avro's source are:
>
> ./share/test/schemas/weather.avsc
> ./share/test/schemas/interop.avsc
> ./share/schemas/org/apache/avro/ipc/HandshakeResponse.avsc
> ./share/schemas/org/apache/avro/ipc/HandshakeRequest.avsc
> ./share/schemas/org/apache/avro/data/Json.avsc
> ./doc/examples/user.avsc
> ./lang/java/trevni/avro/src/test/cases/dremel/sub1/sub.avsc
> ./lang/java/trevni/avro/src/test/cases/dremel/input.avsc
> ./lang/java/compiler/src/test/idl/putOnClassPath/OnTheClasspath.avsc
> ./lang/java/compiler/src/test/idl/input/player.avsc
> ./lang/java/compiler/src/test/idl/input/position.avsc
> ./lang/java/compiler/src/test/idl/input/foo.avsc
> ./lang/java/compiler/src/test/resources/simple_record.avsc
> ./lang/java/maven-plugin/src/test/avro/User.avsc
> ./lang/java/maven-plugin/src/test/avro/directImport/PrivacyDirectImport.avsc
> ./lang/java/maven-plugin/src/test/avro/imports/PrivacyImport.avsc
> ./lang/java/tools/src/test/compiler/input/player.avsc
> ./lang/java/tools/src/test/compiler/input/position.avsc
> ./lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/WordCount.avsc
> ./lang/java/mapred/src/test/avro/TextStats.avsc
> ./lang/java/avro/src/test/resources/FooBarSpecificRecord.avsc
> ./lang/c/tests/schema_tests/pass/interop.avsc
>
> Additionally, one might alter the Schema parser & printer to log each
> schema, then run unit tests and collect these, since there are many
> more schemas that are constructed by the unit tests.  If you're
> interested, I could try to construct a file of valid Avro schemas for
> such testing.

Hmm, interesting... I'll test them on my site one by one, I am sure I
will find some bugs in the schema! Thanks for the resources!

--
Francis Galiegue, [EMAIL PROTECTED]
Try out your JSON Schemas: http://json-schema-validator.herokuapp.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB