Re: JSON headers

"Roy T. Fielding" <fielding@gbiv.com> Thu, 14 July 2016 18:55 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 E2D8C12D1D2 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2016 11:55:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.308
X-Spam-Level:
X-Spam-Status: No, score=-8.308 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=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 (1024-bit key) header.d=gbiv.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 8x91ami4oUKd for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2016 11:55:40 -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 402DE12D16C for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 14 Jul 2016 11:55:39 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bNlj7-0004vb-Uk for ietf-http-wg-dist@listhub.w3.org; Thu, 14 Jul 2016 18:51:13 +0000
Resent-Date: Thu, 14 Jul 2016 18:51:13 +0000
Resent-Message-Id: <E1bNlj7-0004vb-Uk@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 <fielding@gbiv.com>) id 1bNlj2-0004um-A9 for ietf-http-wg@listhub.w3.org; Thu, 14 Jul 2016 18:51:08 +0000
Received: from caibbdcaaahg.dreamhost.com ([208.113.200.76] helo=homiemail-a119.g.dreamhost.com) by lisa.w3.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from <fielding@gbiv.com>) id 1bNlin-00062u-4S for ietf-http-wg@w3.org; Thu, 14 Jul 2016 18:51:01 +0000
Received: from homiemail-a119.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a119.g.dreamhost.com (Postfix) with ESMTP id 72D4160005073; Thu, 14 Jul 2016 11:50:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=content-type :mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=HndMJrVmmbptB44OvP+cr9Uel9o=; b=JMi9UFxFr6C2Cwjt9Mg9V51qNxM1 5ee0NOM32+VJg3nnQqJQUiVGVe0hHX8hJlqbWNCyfw7RmeO+9dd0K5G6xVACYCS8 jcZloTYQM9MW3+rcZSm/4CMuWCZIwze/fbQEx4Pg7fjI4ShOjz5uQHUUkHcedtpT bMrWyxiK7r/1Lt4=
Received: from [192.168.1.7] (ip68-228-71-159.oc.oc.cox.net [68.228.71.159]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by homiemail-a119.g.dreamhost.com (Postfix) with ESMTPSA id 3326260005069; Thu, 14 Jul 2016 11:50:25 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <CAHBU6iurgyL9r3io+0yx8Uqpd7g40e0KJfhkNSLgmj+9HKr_5w@mail.gmail.com>
Date: Thu, 14 Jul 2016 11:50:24 -0700
Cc: Poul-Henning Kamp <phk@phk.freebsd.dk>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <57ECDA4A-A3C6-4639-A08D-BCE07328D6D0@gbiv.com>
References: <74180.1468000149@critter.freebsd.dk> <CAHBU6iurgyL9r3io+0yx8Uqpd7g40e0KJfhkNSLgmj+9HKr_5w@mail.gmail.com>
To: Tim Bray <tbray@textuality.com>
X-Mailer: Apple Mail (2.2104)
Received-SPF: none client-ip=208.113.200.76; envelope-from=fielding@gbiv.com; helo=homiemail-a119.g.dreamhost.com
X-W3C-Hub-Spam-Status: No, score=-6.3
X-W3C-Hub-Spam-Report: AWL=-0.316, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: lisa.w3.org 1bNlin-00062u-4S 11c86be4ea32b242c943f4cad86abf9d
X-Original-To: ietf-http-wg@w3.org
Subject: Re: JSON headers
Archived-At: <http://www.w3.org/mid/57ECDA4A-A3C6-4639-A08D-BCE07328D6D0@gbiv.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31966
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 Jul 9, 2016, at 10:47 AM, Tim Bray <tbray@textuality.com> wrote:
> 
> 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.

I used Orderly <https://github.com/lloyd/orderly> for TPE, as in

  https://tools.ietf.org/html/draft-ietf-http-v11-spec-00#section-3.11

which is at least concise enough to not mind additional prose for if-this-then-must rules.

> 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.

Use of JSON for anything other than javascript declarations is overrated.  But that's life.
I'd prefer to resurrect logic bags with the addition of UTF-8 and Unicode character escapes. ;-)

    https://tools.ietf.org/html/draft-ietf-http-v11-spec-00#section-3.11

....Roy