Re: JSON headers

> 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

Received on Thursday, 14 July 2016 18:51:08 UTC