Return-Path: X-Original-To: apmail-avro-user-archive@www.apache.org Delivered-To: apmail-avro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D5B7EE57 for ; Fri, 22 Feb 2013 22:24:42 +0000 (UTC) Received: (qmail 2349 invoked by uid 500); 22 Feb 2013 22:24:42 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 2296 invoked by uid 500); 22 Feb 2013 22:24:41 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 2281 invoked by uid 99); 22 Feb 2013 22:24:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2013 22:24:41 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fgaliegue@gmail.com designates 209.85.215.182 as permitted sender) Received: from [209.85.215.182] (HELO mail-ea0-f182.google.com) (209.85.215.182) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2013 22:24:35 +0000 Received: by mail-ea0-f182.google.com with SMTP id a12so488296eaa.41 for ; Fri, 22 Feb 2013 14:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=yZLP2x2VGSl9Ut1Rfzbp2SmjN46zwQ3W+juV5eIZyGQ=; b=WMascwlluB2reY4IA+bPlIo8ry27RIKpldDuKPvGXl5BQp2EthoKZYAgEqyO5FDRKH 0moteElGQ2bk25+aV04kgOrkKQ1uavowOM3fE1Ny8WMGf1Zqh5rdWT7Ts7QxlzZeIyZf J1D2r1n5FwoUlm4Wn0Kh8O9NSFWpDetOUjBWX6JWImGIRo0qB1OWTABHf0u2kIG143il awZ8z+2SMyhHAaA3mEbgOufP8wpE+VMQ28AG4nOLJb94Bvj7Dsq5iCGbDZYmRa7Rm8pf tBDoV9btBwBwEDi0Yep/ptSs5BUnnKt2GWPDUxSWHhQAPttCjjEZeSXvRgWUPg6GWw6S zEAQ== MIME-Version: 1.0 X-Received: by 10.14.179.5 with SMTP id g5mr10777686eem.41.1361571854705; Fri, 22 Feb 2013 14:24:14 -0800 (PST) Received: by 10.14.1.7 with HTTP; Fri, 22 Feb 2013 14:24:14 -0800 (PST) In-Reply-To: References: Date: Fri, 22 Feb 2013 23:24:14 +0100 Message-ID: Subject: Re: Experiment: a JSON Schema describing Avro schemas From: Francis Galiegue To: user@avro.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Feb 22, 2013 at 11:12 PM, Doug Cutting 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, fgaliegue@gmail.com Try out your JSON Schemas: http://json-schema-validator.herokuapp.com