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 2:04 PM, Francis Galiegue <[EMAIL PROTECTED]> wrote:
> By default, JSON Schema allows additional members, it will only forbid
> them if additionalProperties is false (or constrain what they can be
> if additionalProperties is a schema)

I didn't realize that.  Thanks for clarifying.

> so the question would rather be,
> is there some scenarios where they are not allowed?

No, I think they should be allowed anywhere.

> Ah, OK. So you can have either a "full" name, a short name and a
> namespace, or even a "full" name and a namespace?

Yes, any of those three are valid.  (When no namespace is specified,
the namespace of the containing schema is implied.)

>>  - 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.

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.
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