Re: [apps-discuss] JSON Schema considered harmful

Phillip Hallam-Baker <hallam@gmail.com> Thu, 20 September 2012 17:47 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3DB0621F881D for <apps-discuss@ietfa.amsl.com>; Thu, 20 Sep 2012 10:47:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.015
X-Spam-Level:
X-Spam-Status: No, score=-4.015 tagged_above=-999 required=5 tests=[AWL=-0.417, BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TKT+RqGMcY4q for <apps-discuss@ietfa.amsl.com>; Thu, 20 Sep 2012 10:47:12 -0700 (PDT)
Received: from mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by ietfa.amsl.com (Postfix) with ESMTP id 4756B21F881B for <apps-discuss@ietf.org>; Thu, 20 Sep 2012 10:47:12 -0700 (PDT)
Received: by obbwc20 with SMTP id wc20so2700462obb.31 for <apps-discuss@ietf.org>; Thu, 20 Sep 2012 10:47:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Ik6MehKXkf3CiZ4Jaxw3eY4HbrIlMfBkRYhgaCqoiB4=; b=PoP2XianHQhDttpOtKomDSDSP7xXO6IZoNfYPEctxkm6nK7meoqm1pRmAXtM5S+g2G 2/PRzQJ7+qJdZZg/V0Qk3sUCQ1mbgCa6OfoltSpA7OgpdgYVlPYSL4kWoypmtsZ00BE9 Aa5xGeEXo5oKY90gyLkyFFkiU2V3aenbJe3eYK1cnCHMDoRLOxX/9zCCX/XgOL8xMxrK lb6pvCJNCjPaz/FdELojLzEQqu3O2TUDVXJd4fD1Pq9tFAImuqpiGzJkmolu3Ajnxhvv 2mh7bpz6gNM/AQotxdOX65hYToSQ6JPS4vXsuUgScb5k2SyrvAeq0mv0JreZB9vl7F72 vymw==
MIME-Version: 1.0
Received: by 10.182.145.35 with SMTP id sr3mr1879607obb.98.1348163231898; Thu, 20 Sep 2012 10:47:11 -0700 (PDT)
Received: by 10.76.18.237 with HTTP; Thu, 20 Sep 2012 10:47:11 -0700 (PDT)
In-Reply-To: <CAHBU6iupyZEhENRVYJ2sMNk79RSZbOVAawr6vP42uzNyO0z+Nw@mail.gmail.com>
References: <CAMm+LwjYj0gd3Cxjj8WFcLy-zgBwfVDCPaRGcNSgOHD9m_07yw@mail.gmail.com> <999913AB42CC9341B05A99BBF358718D01DF0684@FIESEXC035.nsn-intra.net> <CAK3OfOgU-Kepre2Z2dg_S8DAVCU413SRvuWMvJcC3BmE0BjNbQ@mail.gmail.com> <505B43B3.7050503@berkeley.edu> <CAHBU6iupyZEhENRVYJ2sMNk79RSZbOVAawr6vP42uzNyO0z+Nw@mail.gmail.com>
Date: Thu, 20 Sep 2012 13:47:11 -0400
Message-ID: <CAMm+LwiG5i2UMabjWC5NDieMD90mWPU+rd=H6LiDeser_CiFUA@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: Tim Bray <tbray@textuality.com>
Content-Type: multipart/alternative; boundary="f46d04463078895c6904ca25b6e5"
Cc: apps-discuss@ietf.org
Subject: Re: [apps-discuss] JSON Schema considered harmful
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Sep 2012 17:47:13 -0000

On Thu, Sep 20, 2012 at 12:53 PM, Tim Bray <tbray@textuality.com> wrote:

> On Thu, Sep 20, 2012 at 9:26 AM, Erik Wilde <dret@berkeley.edu> wrote:
>
> > i have to admit that i am really curious why the seasoned spec writers
> that
> > have voiced general concerns about the usefulness of schema languages are
> > feeling this way, but so far i have not really understood what they are
> > saying. could somebody please try again, i'd really like to understand
> why
> > the general idea of describing protocol syntax in a semi-formal (as
> opposed
> > to non-formal) way is considered a bad idea.
>
> I gave a preso at IETF70 in Vancouver a few years ago which is advertised
> as being XML-centric, but has (I think) useful things to say about
> plain-text/binary/ASN.1/JSON/XML, and discusses about the proper place of
> schemas: http://www.ietf.org/proceedings/70/slides/xmltut-0.pdf
>
> I believe:
> - ASN.1 has been bypassed by history and has truly horrible tooling. Just
> don’t go there.
>

Agree


> - If you’re interchanging documents, use XML; if (much more common) you’re
> interchanging data structures, use JSON.
>

Agree


> - Do not use multiple syntaxes for the same protocol. Pick one of XML or
> JSON and stick with it.
>

Agree but note that this conflicts with the REST notion of using URL
encoded requests and JSON responses. Which I think is yucky but some insist
on.


> - The most important thing in defining a protocol is good clean
> comprehensible human-readable prose.
>

Agree [hence I do not want to see a JSON or an XML syntax]


> - All the protocols I’ve ever seen have important constraints that can’t
> be expressed usefully in declarative schema languages.
>

Agree and furthermore I have found a good use for the constraints they do
provide.


> - Therefore, the next most important thing is an automated
> validator/test-suite.
>

Agree and want to lock that to the schema and the specification (which I
have done in ProtoGen)


> - A schema is a nice-to-have.
> - If you’re in XML and want schema-ware, use RelaxNG. For an example, see
> RFC4287.
> - If your protocol is JSON, investment in a validator/test-suite has much
> higher ROI than chasing schema unicorns.


Unless you have a tool that will produce the test-suite and the spec (and
other schemas if you really must).


-- 
Website: http://hallambaker.com/