Re: [Json] Schemas & so on

Phillip Hallam-Baker <> Mon, 02 May 2016 03:54 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id C3D6112D1B8 for <>; Sun, 1 May 2016 20:54:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.399
X-Spam-Status: No, score=-2.399 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.199, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id aG0g8ekPikZk for <>; Sun, 1 May 2016 20:54:48 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:400d:c04::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 6DE1912D137 for <>; Sun, 1 May 2016 20:54:48 -0700 (PDT)
Received: by with SMTP id w36so10709938qge.3 for <>; Sun, 01 May 2016 20:54:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=81U/LrloFSGXIqTPSu3B05pyUd50BXCXtwynKwWC5zA=; b=J0eIk9KyEZhcnC7Aof7HUNv98aG9SnhdEUA9Xckl4VBtFXHZEve5ioE6XWEuOmxarl hwj+A0HibkQWoV1AAG417KIjqw6SqkU2MiDXDOtuP1duwLiuyTeon9SSmWwYZC8tla20 EfWBAsHGX8SycKAQqvxD83l6f41SIEhBQNI3JyTaSEY6xNiG4p9aLrw8kBkf3UGyqaJq BGqR0XnkS5m0NJ0TdhpJywuz7dKJztZ2IWuXd5h14iR88/kS9i6bmSkZIIG8ozPVBN4r yi0ba1bS4fP1ArR2Rme3VMf3gVBh2Z5EgZj7mKjPrqpOzP6iVRtqVkulKz6xEVEz+Kt1 2FkA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=81U/LrloFSGXIqTPSu3B05pyUd50BXCXtwynKwWC5zA=; b=D+8rZD6by0mSlb6lKNsg239la1fRhFTa6ykWRRQ/wnAE+Qy6uI1jH7NJu85SuFzaOl ejg2kvbgirITpJm3jK4iM3hurno33ImsJNEai1riHZAJ2yv9FqOWCNoIzGctVWdqxXrU Q/l1I+ILhQ3xwQXYpfhobOUqHkjBwptMAqImlS3/ZUis4ylKiaderq9K4322vxU9yRbl ZC6IYqorYSQ263zvFSy3myyzRD1voAWVtv4k9ewKUxoT/vTmlkqLGj60Z+SMtwo32jn7 4FBHrbf8+XpTQZ6mY4WgEa0qhjY4pHTqEsE9jZKpKEpDImeRwHogK5Z/wQNRvE78B/5f s04g==
X-Gm-Message-State: AOPr4FWyL8l0rBKy94/6O+foGHhU8m1EnMuT02vDy+HpjI2h02XLfyFvawtIfqi0iPs3ULJJ5aSJvQwdoXw86g==
MIME-Version: 1.0
X-Received: by with SMTP id z60mr29700895qgd.70.1462161287547; Sun, 01 May 2016 20:54:47 -0700 (PDT)
Received: by with HTTP; Sun, 1 May 2016 20:54:47 -0700 (PDT)
In-Reply-To: <>
References: <>
Date: Sun, 1 May 2016 23:54:47 -0400
X-Google-Sender-Auth: B8OSjisjV1MG62fr6_1hI9Peiw0
Message-ID: <>
From: Phillip Hallam-Baker <>
To: Tim Bray <>
Content-Type: multipart/alternative; boundary=001a113a7e2e2617f70531d3f469
Archived-At: <>
Cc: "" <>
Subject: Re: [Json] Schemas & so on
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 02 May 2016 03:54:51 -0000

Protogen may do what you want. It isn't anything like XML Schema but
starting from an abstract definition of the protocol, it will generate
implementation code in C or C# and Internet Draft suitable documentation in
Markdown, XML2RFC or HTML.

I used it to develop this spec from start to finish in three days including
a reference implementation:

The big problem with XML schema is that it is trying to provide all the
functionality of DTDs and in a data description language you need none of
that functionality.

At this point the only distinction made in the schema is between lists of
zero, one and many items.

The schema language could be cleaned up. But if I was going to do that, I
would want to develop one input language that works for my ASN.1, RFC822
header, TLS Schema and JSON backends.

TLS schema requires things like integer sizes to be specified. JSON
obviously does not. Except of course for cryptographic bignums where we
tend to use base64 strings.

On Sun, May 1, 2016 at 4:55 PM, Tim Bray <> wrote:

> I find myself tasked with specifying a JSON-based DSL and preparing it for
> public release, with a validator and so on.
> I had never really concerned myself much with options for JSON language
> definition, but have discovered they’re not very good.  The JSON Schema
> project is not terribly appealing - opaque spec, poor documentation and
> tools - and smells of neglect (last I-D expired in 2013).  It's been
> suggested that a good approach would be just to write a jq program that
> emits true or false.
> Is there good conventional wisdom about formally specifying a JSON dialect?
> --
> - Tim Bray (If you’d like to send me a private message, see
> _______________________________________________
> json mailing list