Re: [Json] Schemas & so on

Phillip Hallam-Baker <ietf@hallambaker.com> Tue, 03 May 2016 17:13 UTC

Return-Path: <hallam@gmail.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 9058912DD12 for <json@ietfa.amsl.com>; Tue, 3 May 2016 10:13:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.399
X-Spam-Level:
X-Spam-Status: No, score=-2.399 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.199, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 F_lGa_A2TDaq for <json@ietfa.amsl.com>; Tue, 3 May 2016 10:13:07 -0700 (PDT)
Received: from mail-qg0-x22b.google.com (mail-qg0-x22b.google.com [IPv6:2607:f8b0:400d:c04::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CF32612DCB8 for <json@ietf.org>; Tue, 3 May 2016 10:08:48 -0700 (PDT)
Received: by mail-qg0-x22b.google.com with SMTP id 90so11270534qgz.1 for <json@ietf.org>; Tue, 03 May 2016 10:08:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=2UjjQX9HjpcPJL9Xg/foaQJVG5SOG9bxEncTyN9KUsc=; b=0HT7HUn0gSXk7+T8G44UdnqCVae07+JnoCRDYwZDdcsjnVWsrTI807yf+5TL4JKo0T HFf3DDJvY8N+VJEpO2LY09FElLlDqQUQEGayAOagyIDtObRkDNuQ766O6iUjutcEAvU8 Ar2xm743NPawUGKQtdKVcVJ5GzNOp/KOROtvOO2Z6k2gQuU1Fp7TZIfF+1wlOdsGrQAK ZsYNHpH2Nk+1LvW4GmJIa2mCjIlkSoaN2UNkJUe5A5Y0McQ0d84Zz9Oa0yi+0kEsihdv cc7WJM5e4aDaPbR/BVmFUiiLyAVGlwZnwKe5qpFoW+RdYwy5sai1u/S9BnaWTx1NeUOr lRtw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=2UjjQX9HjpcPJL9Xg/foaQJVG5SOG9bxEncTyN9KUsc=; b=Zx7t9ohdxDNSMcdR7RIizPoEY3UZryX9YrH4Mc1NiMV9tFA8ZayA8q6vxpUc/7hZHK 7xtVqDNLKdsn2Lnf/rtuadZSzSueO00SV6Ge/tLuAUf1u/obPwNTTJ7E4I3JKdrETL8C 0F/itWwDZ7DBZ0+z7Dtt/OvhqiPpKpmcURA+hmS4SvsitQZjtKb7QH0jD1IYG9yptmvi M9i/xQPmFu/rO5u3LZmAHV/fTf3Mp7X+3PU8zXVdzyz4dfiCXQZbvQNLkAN3GJiir/QB MPa/DD0yjIQOz2Ron5zDzGpoJp2N0fG6kEFtONpZyMO2X8/ooCsfYFN/Go3q3OQQOPAa 2VfQ==
X-Gm-Message-State: AOPr4FVi4U6DdEkRjvIEI2jwuHVkeLFDoVQhGPMSVMNNiWsSqlfEoh5cydDRRiXLe70JCkV28Y77pcghDDxt4w==
MIME-Version: 1.0
X-Received: by 10.141.44.135 with SMTP id v129mr3950195qhe.46.1462295327988; Tue, 03 May 2016 10:08:47 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.24.38 with HTTP; Tue, 3 May 2016 10:08:47 -0700 (PDT)
In-Reply-To: <20160503010109.GA17482@mercury.ccil.org>
References: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com> <AC93811D-A16A-4527-B2EB-C6A9FC6D4F17@mnot.net> <20160503010109.GA17482@mercury.ccil.org>
Date: Tue, 03 May 2016 13:08:47 -0400
X-Google-Sender-Auth: R-omOazzxETA0cXxwAzazDc_Bxs
Message-ID: <CAMm+LwjVnh5H4REM9tUJjb7QvL2arxjkhjWybHerxbXUvkcMdA@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: John Cowan <cowan@mercury.ccil.org>
Content-Type: multipart/alternative; boundary="94eb2c0bdc2494e3760531f32940"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/tsv6JM3GPO0zP2dddgo1CqhHdwM>
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 17:13:09 -0000

I don't see any need to specify upper or lower bounds on integers. We don't
do this in C, C# or any major programming language.

We do specify bounds on representation, int32, uint32 etc. But that is more
a matter of convenience and space management. It isn't something we need in
JSON serialization.

What we do need is a model for how to extend JSON based protocols. When is
it allowed to add in new elements to structures? what structures are
backwards compatible with the old? My answers to those being 'always' and
'when the tag is the same'.



On Mon, May 2, 2016 at 9:01 PM, John Cowan <cowan@mercury.ccil.org> wrote:

> Mark Nottingham scripsit:
>
> > It strikes me that it might be worth writing down what we think is good
> > in such a beast, and what would be not-good. Getting agreement on that
> > might be... interesting, but if we had such a document (or maybe just
> > a wiki page), we'd be able to evaluate the current contenders, at least.
>
> Here's what I think the bare necessities are for a schema language.
> This is loosely based on FtanGram, the schema language for FtanML,
> a markup language similar to XML and JSON.
>
> 1) A language for specifying the types of JSON items.  A type is a set of
> JSON items.  If the root item matches the root type and each sub-item
> recursively matches the subtype, then the JSON document is valid,
> otherwise not.
>
> 2) The following primitive types:
> 2a) The set containing only JSON null.
> 2b) The set containing both JSON booleans.
> 2c) The set containing only JSON true.
> 2d) The set containing only JSON false.
> 2e) The set containing all JSON numbers.
> 2f) The set containing all JSON integers.
> 2g) The set containing all JSON strings.
>
> 3) The type of JSON numbers with a specified upper and/or lower bound
> (inclusive or exclusive).
>
> 4) The type of JSON integers with a specified upper and/or lower bound
> (inclusive or exclusive).
>
> 5) The type of JSON strings that match a specified regular expression.
>
> 6) The type of all JSON arrays.
>
> 7) The type of JSON arrays that match a specified regular expression
> over types which match the elements of the array.  The regular expression
> operators are sequence, choice, and bounded and unbounded repetition.
>
> 8) The type of all JSON objects.
>
> 9) The type of JSON objects with specified keys, with the types of the
> values corresponding to those keys.  Keys may be required or optional.
> In addition, a way to specify whether other keys are allowed or forbidden.
>
> 10) The type of all JSON items.
>
> 11) The ability to name a type and refer to it by name.
>
> 12) The ability to define type libraries and import types from them.
>
> Comments?
>
> --
> John Cowan          http://www.ccil.org/~cowan        cowan@ccil.org
> Awk!" sed Grep. "A fscking python is perloining my Ruby; let me bash
>     him with a Cshell!  Vi didn't I mount it on a troff?" --Francis Turner
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>