Re: [Json] Schemas & so on

Peter Cordell <petejson@codalogic.com> Tue, 03 May 2016 14:26 UTC

Return-Path: <petejson@codalogic.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3A8921200A0 for <json@ietfa.amsl.com>; Tue, 3 May 2016 07:26:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.92
X-Spam-Level:
X-Spam-Status: No, score=-0.92 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RDNS_DYNAMIC=0.982, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hzPbjMF6GY-R for <json@ietfa.amsl.com>; Tue, 3 May 2016 07:26:51 -0700 (PDT)
Received: from ppsa-online.com (lvps217-199-162-192.vps.webfusion.co.uk [217.199.162.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F35BC12D0A4 for <json@ietf.org>; Tue, 3 May 2016 07:26:47 -0700 (PDT)
Received: (qmail 25245 invoked from network); 3 May 2016 15:22:08 +0100
Received: from host31-54-178-133.range31-54.btcentralplus.com (HELO ?192.168.1.72?) (31.54.178.133) by lvps217-199-162-217.vps.webfusion.co.uk with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 3 May 2016 15:22:08 +0100
To: John Cowan <cowan@mercury.ccil.org>, Erik Wilde <erik.wilde@dret.net>
References: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com> <AC93811D-A16A-4527-B2EB-C6A9FC6D4F17@mnot.net> <4bb21809-bb40-7a3e-b7c7-f37da0976ea2@dret.net> <20160503131248.GA22066@mercury.ccil.org>
From: Peter Cordell <petejson@codalogic.com>
Message-ID: <60c96d28-70a5-f3a3-30b3-b6f7232b60ab@codalogic.com>
Date: Tue, 03 May 2016 15:26:43 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
MIME-Version: 1.0
In-Reply-To: <20160503131248.GA22066@mercury.ccil.org>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/1IAzFiyFk7jTY0JVU4p0zxk_o8M>
Cc: Mark Nottingham <mnot@mnot.net>, Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Schemas & so on
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 03 May 2016 14:26:53 -0000

On 03/05/2016 14:12, John Cowan wrote:
> However, I think that there is a counterexample to the "no JSON syntax"
> claim, which is Examplotron.  ...
>
> I had hoped, when I started to read the JCR document, that JCR was a
> language of this type.  But while valid JSON instances are for the most
> part also valid JCR, an instance does not match other structurally similar
> instances: instead, it matches only itself, making it entirely useless.
>

I disagree that JCR is "entirely useless".  I think it's a great 
strength that you can start with an actual JSON example, but then 
generalise it via annotation to be more embracing.  I think Examplotron 
is neat, but it makes lots of assumptions about what you're trying to 
express.  It essentially guesses what you mean by a construct.  This may 
work for a little while, but soon runs out of steam.  There's a reason 
why people say you should be explicit about what you want.

Plus, there is the issue of practical syntax.  XML offers namespaces so 
you can do things like <bar eg:occurs="*"> to differentiate between one 
or more and zero or more (or optional etc).  Lacking even comments it's 
hard to see how a JSON based syntax could do this is an elegant way.  (I 
can imagine some ugly hacks involving unlikely member names, but I'd 
really rather not.)

And the ability to explicitly state that you want a particular string 
(for example), rather than having that being inferred as any string, 
opens up the use of JCR as part of a test vector suite, which could be 
very useful as part of implementation validation.

So, very useful indeed IMO.

Pete.
-- 
---------------------------------------------------------------------
Pete Cordell
Codalogic Ltd
Read & write XML in C++, http://www.xml2cpp.com
---------------------------------------------------------------------