Re: [Json] Schemas & so on

Phillip Hallam-Baker <ietf@hallambaker.com> Mon, 02 May 2016 03:54 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C3D6112D1B8 for <json@ietfa.amsl.com>; Sun, 1 May 2016 20:54:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.399
X-Spam-Level:
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: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 aG0g8ekPikZk for <json@ietfa.amsl.com>; Sun, 1 May 2016 20:54:48 -0700 (PDT)
Received: from mail-qg0-x234.google.com (mail-qg0-x234.google.com [IPv6:2607:f8b0:400d:c04::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6DE1912D137 for <json@ietf.org>; Sun, 1 May 2016 20:54:48 -0700 (PDT)
Received: by mail-qg0-x234.google.com with SMTP id w36so10709938qge.3 for <json@ietf.org>; Sun, 01 May 2016 20:54:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; 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; d=1e100.net; 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 10.140.91.194 with SMTP id z60mr29700895qgd.70.1462161287547; Sun, 01 May 2016 20:54:47 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.24.38 with HTTP; Sun, 1 May 2016 20:54:47 -0700 (PDT)
In-Reply-To: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com>
References: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com>
Date: Sun, 1 May 2016 23:54:47 -0400
X-Google-Sender-Auth: B8OSjisjV1MG62fr6_1hI9Peiw0
Message-ID: <CAMm+LwhSbXRwAGnUxn0fWA62=HsnLtZR0VNYoY99sdmMx8e2Mw@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: Tim Bray <tbray@textuality.com>
Content-Type: multipart/alternative; boundary=001a113a7e2e2617f70531d3f469
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/L2-ssFxqSBPpqJU1QyHOzExM0LE>
Cc: "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Schemas & so on
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
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: <https://mailarchive.ietf.org/arch/browse/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: Mon, 02 May 2016 03:54:51 -0000

https://github.com/hallambaker/PHB-Build-Tools

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:

https://tools.ietf.org/html/draft-hallambaker-lurk-02


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 <tbray@textuality.com> 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
> https://keybase.io/timbray)
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>
>