[Json] Modularity and composition

Phillip Hallam-Baker <hallam@gmail.com> Sat, 15 March 2014 14:06 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 52E551A0150 for <json@ietfa.amsl.com>; Sat, 15 Mar 2014 07:06:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-0.001, WEIRD_PORT=0.001] autolearn=ham
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 ECaiREmTZl9q for <json@ietfa.amsl.com>; Sat, 15 Mar 2014 07:06:42 -0700 (PDT)
Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com [IPv6:2a00:1450:4010:c04::22a]) by ietfa.amsl.com (Postfix) with ESMTP id AD1321A014D for <json@ietf.org>; Sat, 15 Mar 2014 07:06:41 -0700 (PDT)
Received: by mail-lb0-f170.google.com with SMTP id s7so2586646lbd.29 for <json@ietf.org>; Sat, 15 Mar 2014 07:06:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=kN2JDhbwSeioqb+1n5rLsRLSn/l32EgTsOEKP5dEncg=; b=P3Tu/sfzqZ/anTz/41P/YAj0B0zi986cKMw+oAKJUIsJfLwbBm7yLn73f7JBQ7h9Cm XA8m+/mDCN6/K497EtSSOpLuQNvZvDocTcb2cWmPy7atlnvIfWyoeL+ptQEcbQRJT6zG 38uxZgQb4dlxeLUZV0I8/WXS8EF+6RdftMo76W+QBSWXzzsbOQo4z8OJjJv+DTsuCsgL GjWJzcyB5XPy+yVA6LlCBxuGBCvJGvir9E+NRvY6gK4s10lOK8nQ6HSgYMH3MojjjrDL lj4n3Ro1cRi8anwZHim5S+EGZr/oovsSpJZ6t3752fdqXXOlZYYJ7ao6jsMRP2it2C9+ 142A==
MIME-Version: 1.0
X-Received: by 10.112.45.108 with SMTP id l12mr9342466lbm.21.1394892393900; Sat, 15 Mar 2014 07:06:33 -0700 (PDT)
Received: by 10.112.234.229 with HTTP; Sat, 15 Mar 2014 07:06:33 -0700 (PDT)
Date: Sat, 15 Mar 2014 10:06:33 -0400
Message-ID: <CAMm+Lwi+zKa4fugYb23ivTqRPMqw=1rQx3ZwBafkmT1e9cCu9g@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: JSON WG <json@ietf.org>
Content-Type: multipart/alternative; boundary="001a1134bfc8a3705c04f4a5b12d"
Archived-At: http://mailarchive.ietf.org/arch/msg/json/mchdjFecE2fDyO-3wQZnvikJTek
Subject: [Json] Modularity and composition
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 15 Mar 2014 14:06:45 -0000

I strongly support removing the namespace parameter for I-JSON. I
understand what is being attempted there but it does not work in XML so I
see no reason to repeat it. Here is what I think works instead. I don't
think this should become part of the I-JSON draft but it would be useful to
describe it as an example of one approach to JSON modularity.


The key feature that JSON has which XML does not is that a JSON tag may be
any valid UNICODE string. That means that we can put a URI in it.

Now what makes more sense to you:

{ "tag1" : "you don't know what this is about yet",
   "jsonns" : "urn:iana:protocols:foo:v1"
  "tag2" : "more tags at the same lexical level as the namespace" }

or

{  "urn:iana:protocols:foo:v1" {
 "tag1" : "The enclosing tag shows what this is all about",
  "tag2" : "More tags within the defined space" } }

What I really like about this approach is that it is clear that what is
being included is a separate data object that should be handed off to a
separate handler.


One of the more awesome features of the .NET platform is that it allows
service applets to register code to handle parts of the HTTP URL namespace.
So you can register a handler for "http://example.com:8000/.well-known/foo".

But the URL space is an administrator space. Not a protocol space. The
command type should be specified in the protocol messages not the transport
binding. Having the protocol commands passed in HTTP headers makes no more
sense than putting them in TLS extensions.


This lexical approach would make it possible to do similar tricks within a
handler for JSON based Web services. Let us imagine that we decide to
package up our request and response data as follows:

{ "urn:iana:protocols:foo:v1:GET-Request": { ... ...}}

or maybe the URI stem is implicit:

{ "GET-Request": { ... ...}}

Note that all the information relevant to the protocol is now in one place.


The part where the wheels came off the tomato for XML namespace was when we
tried XML Digital Signature. That led to canonicalization which let to
bizarre transformational approaches. Yuk!

The approach I suggest here works really well with signed or encrypted data
objects. The only catch is that you have to understand that Digital
Signatures sign a list of octets and not an object. So this approach is
doomed to fail:

{ "Signed-Data":  { "tag": "Never gonna work reliably"}}

To get the scheme to work we have to Base64 the signed data so that the
sender.


[At ths pont the  and  ey on my MacBoo have broen so the rest mght be
dffcult to read and  wll stop.]



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