Re: [Json] Accidental schema language

Phillip Hallam-Baker <ietf@hallambaker.com> Fri, 02 December 2016 16:22 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 D2CD812978B for <json@ietfa.amsl.com>; Fri, 2 Dec 2016 08:22:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 2Y-m1kc4hxPC for <json@ietfa.amsl.com>; Fri, 2 Dec 2016 08:22:22 -0800 (PST)
Received: from mail-wj0-x242.google.com (mail-wj0-x242.google.com [IPv6:2a00:1450:400c:c01::242]) (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 CA4731296D2 for <json@ietf.org>; Fri, 2 Dec 2016 08:22:21 -0800 (PST)
Received: by mail-wj0-x242.google.com with SMTP id j10so3467490wjb.3 for <json@ietf.org>; Fri, 02 Dec 2016 08:22:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=zRsaJnOD7CW/lYbfK5NIHMmOFsHcGzktrDCvikMkFw8=; b=F0wx8DR8099A6tsCG0Breg0pZ+kepLqFI1uCgVQ1/mMzMaJCXjtx6htVsexIpG+evN MOm/fanHM9mu9ZUqEMk5uj5sR5iEDQMFHwKLTgaBMxJz+QLyrVKSz7R2b2lwp2ymYoHG ZHz2AuPDjq/OXeIEczqVpL4buztHJi5tDtVVJsA3vuVNnyRRmWymSKlnWqVjGnSGJQg/ E64XKNwxyEo9KNCZCpQf9LgBPv/q3HX3ZDAJVKTS/3TUmPdOTLW3h2GcMA6hFrBXw5Xw uC4zI4F3X51AIMWYWLNNG+FCcOdpfr8xeDhDaIgJJiEplwZ6E3GB+xv9jCDUQHZIOIlQ ZqgQ==
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:from :date:message-id:subject:to:cc; bh=zRsaJnOD7CW/lYbfK5NIHMmOFsHcGzktrDCvikMkFw8=; b=Gs9v5lJ6P4WqtGmCO/FJ4TRLg/AMlJfpSz3/lA+XTLAR0/olbPOi4kbqzlQRjfpw5C IuvTwnr78XY92NxUJUJSK9sDSvLqDfQAk6cle+B/45e9Qfnfhyk0wMzvqvlBZLPNPiJM 9LiS83/sClWOzLDJcz8ysHF3NwDpzLIvS9sf0ZSl9tVQoLiDj7vIZpKfkoTgemG1wQjQ PYJZjmOfwzSV3MWEdd+Ukq58k2+3dQ/cEAFCUVpFRRZPRKFKdeyLFzfCnou+/vQWfe5s 7A05rvJpewTErICtpVHjbFSTuPBacj5/MknkV2Fspd9TGfLYUV4eXlJZQ+0yQHxk7Jor rByw==
X-Gm-Message-State: AKaTC01t8T9NmvRfdVpfeHg0s7PuO1YiqYt5xa/AO7G6LREOXVajVXp7Wo2/j3GWAUoaPuuuBuh1m0YkLMT45g==
X-Received: by 10.194.14.196 with SMTP id r4mr14338491wjc.54.1480695739831; Fri, 02 Dec 2016 08:22:19 -0800 (PST)
MIME-Version: 1.0
Sender: hallam@gmail.com
Received: by 10.194.83.101 with HTTP; Fri, 2 Dec 2016 08:22:19 -0800 (PST)
In-Reply-To: <B088A186-5FB9-4E9D-A37E-586EAF903E79@nic.cz>
References: <CAHBU6ivTaiHyBXBRBPjc3t=eM_zSd64mQ3h2f9o6WO4sMyXWsg@mail.gmail.com> <B088A186-5FB9-4E9D-A37E-586EAF903E79@nic.cz>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
Date: Fri, 02 Dec 2016 11:22:19 -0500
X-Google-Sender-Auth: P_y3go09Du2PVQ_SMKCLejnyCzE
Message-ID: <CAMm+LwhVioJz6hPCNqg4c4h02Pxhtxvd0fQt10nu8bDi3jybpw@mail.gmail.com>
To: Ladislav Lhotka <lhotka@nic.cz>
Content-Type: multipart/alternative; boundary="047d7b66fd9d97dd7c0542af5750"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/rBIKtOy0UZVG3ywaRzcFYFn6Thk>
Cc: Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Accidental schema language
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: Fri, 02 Dec 2016 16:22:25 -0000

If people are interested in this stuff, I have a protocol compiler that I
built to construct this:

http://prismproof.org/

The code base actually contains compilers for ASN.1, XML and TLS-Schema
type encodings besides JSON. But right now these are three separate
processors rather than one.

It is all open source under MIT license and can target Windows, Linux or
OSX. The latest version is limited to C# but thats just because the C
backend lags a little.

The way it works is, you write the schema:

https://github.com/hallambaker/Mathematical-Mesh/blob/master/Goedel.Mesh/SchemaMesh.protocol

This is then used to generate the reference section of your Internet Draft:

https://tools.ietf.org/html/draft-hallambaker-mesh-reference-03

The generator also emits code (currently C#)

https://github.com/hallambaker/Mathematical-Mesh/blob/master/Goedel.Mesh/SchemaMesh.cs

You can generate code using a linemode tool and makefile of course. If you
are using Visual Studio, the code generator is integrated into the shell as
a VSIX extension.

The code is currently configured to generate reference code. Which means
that it is intentionally strict in what it accepts and might well become
permissive in what it generates. Reference code should give implementations
a workout.

I have just spent six months cleaning up the code to make it suitable for
production use (with some caveats) The main thing that is missing is that
people should use something like MongoDB as the backend.

The code can also generate examples. These can be emitted as Markdown, HTML
or XML2RFC format. The Markdown format is the one I use.

*Next Steps*

My system meets my current needs. It is not as pretty as it could be but it
is functional and provides a lot more functionality than the YANG tool
chain. My schema language is rather more abstract.

What I would want to do to improve the product is to replace the three
different frontends I use right now with one common frontend. I would also
want that frontend to use a syntax that matches the JSON data model. I
certainly do not want to use JSON. I did sketch out a JSON-A that would be
programmer friendly.