Re: JSON headers

Tim Bray <tbray@textuality.com> Sat, 09 July 2016 17:52 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0C82312B02E for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Sat, 9 Jul 2016 10:52:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.307
X-Spam-Level:
X-Spam-Status: No, score=-6.307 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.287, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=textuality-com.20150623.gappssmtp.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 4OOCk-b2t98x for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Sat, 9 Jul 2016 10:52:32 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 92C17127077 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Sat, 9 Jul 2016 10:52:32 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bLwMc-0000en-6r for ietf-http-wg-dist@listhub.w3.org; Sat, 09 Jul 2016 17:48:26 +0000
Resent-Date: Sat, 09 Jul 2016 17:48:26 +0000
Resent-Message-Id: <E1bLwMc-0000en-6r@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <tbray@textuality.com>) id 1bLwMZ-0000e0-4L for ietf-http-wg@listhub.w3.org; Sat, 09 Jul 2016 17:48:23 +0000
Received: from mail-qt0-f180.google.com ([209.85.216.180]) by lisa.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <tbray@textuality.com>) id 1bLwMV-0002fC-Tv for ietf-http-wg@w3.org; Sat, 09 Jul 2016 17:48:22 +0000
Received: by mail-qt0-f180.google.com with SMTP id c34so35922921qte.0 for <ietf-http-wg@w3.org>; Sat, 09 Jul 2016 10:47:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=textuality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NKTr2/BhLNQcXUgKEuMEhEN3s8egyQNN5ff1G8D+0Vw=; b=HF0AXp63i8i7oz0loOcvXqTwEResERfJ+qOxPHs4Xj1DB6daDobCBAk5aC/r7V2eJJ TpjYUwcK9EqdnjCInJy4KpJ3mc3iYJl9hoe2N7gOfNXlwrnCyxtTA5k/+VLgSLzm5MEv 1GQr2yyijQpLeagX0gO8/9gZLELJjF3MzPznNvu8JDnoNj+8CydNHqe67X8ne/ZnoGjh LLVmNXieMjDP4XFmfvJjKB2MvB46G1Kpdy07vJQuUv62p1zu2mz4Fa6ncYsqYKdZmSzi Z1rtvA2iweArbsCWgnmwQc0wgid+HQnBf7z4PWmGfSbbkFOPQjE9UofAR8icR3cDYrAU WP5w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NKTr2/BhLNQcXUgKEuMEhEN3s8egyQNN5ff1G8D+0Vw=; b=ceu3gqvMPX5hJB11ulEuvwEjNjwX+itV1tHSeUI2SktNAQJsNjnMpw93pRlwZUGn2b Vls0SUhXT2J5UeLCsBjew7sy7Mk14a0wh2wP3kBCRucliROmqffGtLtUljmA95ix/4mh B/zcpQNg1RgEPdsf89HPl16F0KQ3z96ZZSU58aTZD4e/Jeh8pnNT/71eO5A1SzSwGnmD 9644sc6DiTgv1BXY8ffk1E4razo180EhtKmcgX2RvxUsBCrMeB+XtFOXg/0WbzdhFl9x u0ABT/n+JL5nYhb0ZoguAYBBAB9g1OxQaqXaGaOKJx7PjqEtBKybMVyBQ46NUbza4NEc PE+g==
X-Gm-Message-State: ALyK8tJ8s2nYpFuwKmMweACZbu+Ua55er8mjNUZy5rx2itIdBBmkU1O4648lJ5768hrb4VxGsebGF5JGcJd8+Q==
X-Received: by 10.200.39.66 with SMTP id h2mr17000687qth.7.1468086473580; Sat, 09 Jul 2016 10:47:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.140.100.178 with HTTP; Sat, 9 Jul 2016 10:47:34 -0700 (PDT)
X-Originating-IP: [24.84.248.61]
In-Reply-To: <74180.1468000149@critter.freebsd.dk>
References: <74180.1468000149@critter.freebsd.dk>
From: Tim Bray <tbray@textuality.com>
Date: Sat, 09 Jul 2016 10:47:34 -0700
Message-ID: <CAHBU6iurgyL9r3io+0yx8Uqpd7g40e0KJfhkNSLgmj+9HKr_5w@mail.gmail.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="001a113f405ac2197905373784d7"
Received-SPF: none client-ip=209.85.216.180; envelope-from=tbray@textuality.com; helo=mail-qt0-f180.google.com
X-W3C-Hub-Spam-Status: No, score=-6.2
X-W3C-Hub-Spam-Report: AWL=-0.613, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, W3C_AA=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: lisa.w3.org 1bLwMV-0002fC-Tv 2d91647dc23eab724584218d992ffa3c
X-Original-To: ietf-http-wg@w3.org
Subject: Re: JSON headers
Archived-At: <http://www.w3.org/mid/CAHBU6iurgyL9r3io+0yx8Uqpd7g40e0KJfhkNSLgmj+9HKr_5w@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31849
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On Fri, Jul 8, 2016 at 10:49 AM, Poul-Henning Kamp <phk@phk.freebsd.dk>
wrote:

> How do we specify this in RFCs
> ------------------------------
>
> This is the BIG one.
>
> Julians draft does not addrss this at all:  We need a "ABNF" for
> specifying the structured syntax of standard headers.
>
> Before we open the floodgates for JSON (or whatever) headers,
> we absolutely have to have found and nailed down how they will
> be documented/specified in RFCs.
>

​In my work at AWS I am in the middle of shipping a product with a JSON DSL
and writing a validator for the DSL.  The current repertoire of tools for
specifying and syntax-checking JSON declaratively is ​somewhere between
miserable and pathetic.  JSON Schema is better than nothing but the nature
of its construction makes it basically impossible to produce human-friendly
error messages.  CDDL and JSON Content Rules are interesting attempts but
still not remotely mature.

Also, I have found it more or less impossible to write MustIgnore rules
into JSON Schema saying like “If you spot a field you don't recognize,
that's OK, but if this field does occur it MUST meet these constraints”.
Which I think is important for network payloads.

At work, we actually used JSON Schema to help validate (better than
nothing), but with buckets of procedural code for this and that.  In the
actual specification we're going to publish, screw the schema stuff, it's
all IETF-style English prose: “The Foo object MUST contain a field named
Bar whose value MUST be an array all of whose members MUST be strings that
<description of required string syntax>”.

I’m actually not convinced that the lack of a good way to declaratively
specify a JSON DSL, for example for HTTP headers, is that big of a
problem.  Schemas are overrated.  Clear English prose is under-rated.