Re: [apps-discuss] JSON Schema considered harmful

Tim Bray <tbray@textuality.com> Thu, 20 September 2012 16:53 UTC

Return-Path: <tbray@textuality.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 8DB2021F853B for <apps-discuss@ietfa.amsl.com>; Thu, 20 Sep 2012 09:53:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.727
X-Spam-Level:
X-Spam-Status: No, score=-4.727 tagged_above=-999 required=5 tests=[AWL=-1.751, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, 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 5g3pIllQRA5s for <apps-discuss@ietfa.amsl.com>; Thu, 20 Sep 2012 09:53:16 -0700 (PDT)
Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by ietfa.amsl.com (Postfix) with ESMTP id 794CE21F850C for <apps-discuss@ietf.org>; Thu, 20 Sep 2012 09:53:16 -0700 (PDT)
Received: by weyx48 with SMTP id x48so1519908wey.31 for <apps-discuss@ietf.org>; Thu, 20 Sep 2012 09:53:15 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=iYsexOz4qajkPReeMVyi8/oKHc5LC+L5Rr5wv4KW68E=; b=SFOYdbnq7eSaqJomsVuTaGF5gqpnm7E/kPtH+IlvFvcLWFaPylBry4HxwrdZfXhCI3 D3XpCZVl6Yokik6CBrbFWIHLVSHB1QWV+GtB9gpY6QFWHi5+yvcAV9Ful3GXYkh9eK2h qvHDTup34OHvuQWVFydEVM4bU01cZ3Rh/UVcuk258VXbB3GawYi7LIuvxLwyavpF3MoW 85ToVDHDE8vND0iG5d0D5hwRYbanZGJGsg/WY2HKBgQKAmzpQuHI+LXrEjMkNE/FH6vN bP/ybUH/WzW6snMYzKRagwvhbaEUM6cedTE2VspkrQYCGZzBQ3K08mQM3TKPJL5sMJ8C VVDA==
MIME-Version: 1.0
Received: by 10.180.84.164 with SMTP id a4mr5654444wiz.12.1348159995521; Thu, 20 Sep 2012 09:53:15 -0700 (PDT)
Received: by 10.195.13.200 with HTTP; Thu, 20 Sep 2012 09:53:15 -0700 (PDT)
X-Originating-IP: [24.84.208.217]
In-Reply-To: <505B43B3.7050503@berkeley.edu>
References: <CAMm+LwjYj0gd3Cxjj8WFcLy-zgBwfVDCPaRGcNSgOHD9m_07yw@mail.gmail.com> <999913AB42CC9341B05A99BBF358718D01DF0684@FIESEXC035.nsn-intra.net> <CAK3OfOgU-Kepre2Z2dg_S8DAVCU413SRvuWMvJcC3BmE0BjNbQ@mail.gmail.com> <505B43B3.7050503@berkeley.edu>
Date: Thu, 20 Sep 2012 09:53:15 -0700
Message-ID: <CAHBU6iupyZEhENRVYJ2sMNk79RSZbOVAawr6vP42uzNyO0z+Nw@mail.gmail.com>
From: Tim Bray <tbray@textuality.com>
To: Erik Wilde <dret@berkeley.edu>
Content-Type: multipart/alternative; boundary=f46d043c06e6a2295a04ca24f57b
X-Gm-Message-State: ALoCoQn1pXMVJP2sU869otdQtBb+X3jlytLau5CcEUQmAzc5O7mOxyeunwESz1eabsw0h95vzzj5
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 16:53:17 -0000

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.
- If you’re interchanging documents, use XML; if (much more common) you’re
interchanging data structures, use JSON.
- Do not use multiple syntaxes for the same protocol. Pick one of XML or
JSON and stick with it.
- The most important thing in defining a protocol is good clean
comprehensible human-readable prose.
- All the protocols I’ve ever seen have important constraints that can’t be
expressed usefully in declarative schema languages.
- Therefore, the next most important thing is an automated
validator/test-suite.
- 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.



>
> thanks a lot and kind regards,
>
> dret.
>
> --
> erik wilde | mailto:dret@berkeley.edu  -  tel:+1-510-2061079 |
>            | UC Berkeley  -  School of Information (ISchool) |
>            | http://dret.net/netdret http://twitter.com/dret |
> _______________________________________________
> apps-discuss mailing list
> apps-discuss@ietf.org
> https://www.ietf.org/mailman/listinfo/apps-discuss