Re: [apps-discuss] Describing JSON document formats

Phillip Hallam-Baker <hallam@gmail.com> Fri, 30 November 2012 17:13 UTC

Return-Path: <hallam@gmail.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 5F20421F88C7 for <apps-discuss@ietfa.amsl.com>; Fri, 30 Nov 2012 09:13:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.873
X-Spam-Level:
X-Spam-Status: No, score=-3.873 tagged_above=-999 required=5 tests=[AWL=-0.275, BAYES_00=-2.599, 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 N7MDuJQ7Bey6 for <apps-discuss@ietfa.amsl.com>; Fri, 30 Nov 2012 09:13:23 -0800 (PST)
Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by ietfa.amsl.com (Postfix) with ESMTP id 59DCA21F8965 for <apps-discuss@ietf.org>; Fri, 30 Nov 2012 09:13:23 -0800 (PST)
Received: by mail-vb0-f44.google.com with SMTP id fc26so11087516vbb.17 for <apps-discuss@ietf.org>; Fri, 30 Nov 2012 09:13:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3Wzw2M333EPYpsnB55A4uniBrEuglOX7G2btOds01nE=; b=tYT8Ak6ZG0RRqTfMbkKnRhyVCnp/xbvgn1l73REYla2nBYCMJ+An97aljR0aCsc2mp Ii2SKIABb4vlh/ssS5627bddr2jpSIG7NO16yaupZY3tiuC9Aimt6R6XvBcGLw/tFmzp ha03oZ9CndUWaRRY6A/5pvHZPICajQVLw5VrhftSxqbeJcGfcG49jzgXcHTWBssjUf3b 4Fmr0TMb/Q4cYRSJZ5IzRZOVjQhq7jCkOiJW3RB4VWW3Fc3+SkmzXWm57MhGJYkI6994 5mIlvN6J1maYOX83c2RPdeGMth4l6M9u9TSJjvnqFj7DM8BE56Ig79MPWleBy620lU+A 04Qg==
MIME-Version: 1.0
Received: by 10.220.241.141 with SMTP id le13mr1525443vcb.26.1354295602715; Fri, 30 Nov 2012 09:13:22 -0800 (PST)
Received: by 10.58.19.130 with HTTP; Fri, 30 Nov 2012 09:13:22 -0800 (PST)
In-Reply-To: <26263E0AC2BA16FFBE9930DE@caldav.corp.apple.com>
References: <26263E0AC2BA16FFBE9930DE@caldav.corp.apple.com>
Date: Fri, 30 Nov 2012 12:13:22 -0500
Message-ID: <CAMm+Lwg9T318a+C7kip76Vy6yb76pkcXQquipz2Ez84sfn+vyg@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: Cyrus Daboo <cyrus@daboo.name>
Content-Type: multipart/alternative; boundary="14dae9cdc32b521b0f04cfb984bd"
Cc: IETF Apps Discuss <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] Describing JSON document formats
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: Fri, 30 Nov 2012 17:13:24 -0000

On Fri, Nov 30, 2012 at 11:34 AM, Cyrus Daboo <cyrus@daboo.name> wrote:

> Hi folks,
> <https://datatracker.ietf.org/**doc/draft-douglass-timezone-**service/<https://datatracker.ietf.org/doc/draft-douglass-timezone-service/>>
> and <https://datatracker.ietf.org/**doc/draft-kewisch-et-al-**
> icalendar-in-json/<https://datatracker.ietf.org/doc/draft-kewisch-et-al-icalendar-in-json/>>
> both define JSON document formats.
>
> In the former case, the spec defines the semantics of the response - we
> choose to use <https://datatracker.ietf.org/**
> doc/draft-newton-json-content-**rules/<https://datatracker.ietf.org/doc/draft-newton-json-content-rules/>>
> as the way to describe that.
>
> In the later case, the spec defines a mapping of syntax only, with the
> actual semantics primarily determined by the underlying iCalendar
> specification. In that case we choose to use ABNF to represent the document
> syntax.
>
> My question is, is there any right way to describe a JSON document format?
> I know there are various JSON schema proposals out there, of which
> draft-newton-json-content-**rules was the one I liked the most, and
> obviously I would be interested in seeing that document proceed. Any
> thoughts?


I think it would be very useful to have a mechanism that allowed JSON
formats to be mapped onto data structures and back.

I think that a mechanism that looked anything like XML Schema with the
maximum and minimum values for integers or with regular expressions and
such should be left at the door.

I also think that there is no need to use JSON syntax for the purpose of
defining the data structures.


Good:

Structure Account
    String Username
    String Realm
    DateTime Created


Bad:

Structure Widget
    Integer Height { min=1, max=142}
    Integer Width {min=1, max=23}


I have written quite a few XML Schema specs and I have never ever found a
need for more than about 10% of the features. It is not necessary to
specify the minimum and maximum number of occurrences. The lower bound is
always 0 or 1, the upper bound is always 1 or infinity.

Schema validation is bunk.


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