Re: [Json] A minimal examplotron-style JSON validation language.

Ulysse Carion <ulysse@segment.com> Thu, 30 May 2019 00:07 UTC

Return-Path: <ulysse@segment.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 BD4621200B7 for <json@ietfa.amsl.com>; Wed, 29 May 2019 17:07:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=segment.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 1PL3gyndUSev for <json@ietfa.amsl.com>; Wed, 29 May 2019 17:07:43 -0700 (PDT)
Received: from mail-it1-x12f.google.com (mail-it1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 5E311120020 for <json@ietf.org>; Wed, 29 May 2019 17:07:43 -0700 (PDT)
Received: by mail-it1-x12f.google.com with SMTP id m141so7082192ita.3 for <json@ietf.org>; Wed, 29 May 2019 17:07:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=segment.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8jsPfGBBh6+24E2g/yyYAb2HxfJQ/yzec5rCpzyJ4pg=; b=ZXBfnOfz/7OKUu5ZetDXrTVc0hkZKVEZumw4bRg1wJApG+6a3BHPr465gZdnrYci4n 5CUvrmt3XPuhn5jy05fFQqAKRZme5rQtANTd4XCftJi2YVZorDC3ZWWyntjWbq3SxJbP VvlzkwgNYnfworV7a3HIKxgq063XFiyX5j/2s=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8jsPfGBBh6+24E2g/yyYAb2HxfJQ/yzec5rCpzyJ4pg=; b=KEL6pQIma5mWhfhp7ng/r7Ztqy17uGaBxbpboHznPx37geiIswqfkf8gQZx4kqb5Zm I14p0WuotiEhmp6QaD+KjLvdJVSZAct+dWRWmQIGZ9dULfYiuJjwTmXYyOxWqGBv0+M+ P52ITxfDnIAnJAaNV+r7BxIf7xDng5gdBqKYvHfftlmjLKr3XTunyMTAxtNYEt6cSTtZ o55Di7fMc0EMUUVuNKwOj77hoC0AO8VrN1OLFFtU4JNyZLoqLKiIoUcGvRe+QzAyyNFi PSacVajtsslcooJWOBJ60t6OP2SzRliS5YhAFhToUILhJtmrgFWMKAELk7Sr2YNn9NoF O5Yg==
X-Gm-Message-State: APjAAAUlnjudzYVwl1eg3Z/5AWkhtLx9qNef0giY8bI0Dxv8MkuzAG8c 0I9OK0bjREvk7dZNI08IcwINiAMRBMzgIjX/NhOYvA==
X-Google-Smtp-Source: APXvYqz/1ed8j9r+LG/3qOO0Cx/wPKSNta2iBpCIb+uzHRqdok8klONcx5w7X81wQb4OeSQTid6u78KccwQBgt31fdY=
X-Received: by 2002:a24:1416:: with SMTP id 22mr822400itg.144.1559174862346; Wed, 29 May 2019 17:07:42 -0700 (PDT)
MIME-Version: 1.0
References: <8224451C-F21B-41E5-A834-A9005050CB1F@tzi.org> <CAJK=1RjdYD6TZCNrw=H3d9ZLKLxZZOwVCOYYPwfbP+1ETDDz1Q@mail.gmail.com> <11CDA7F6-30BB-40E4-8926-2EDCBCFD785B@tzi.org> <CAHBU6iv8ZsFM5yco5gi+gcyU8d=u3bOSgiKaF6-hv-GARgNh9w@mail.gmail.com> <CAChr6SwNvG4Z7TKUxAVeH7HMVWiPsEBNb12K9zVkjaGt2_v0fw@mail.gmail.com> <CAHBU6ivTD_v7L-wQ+P9TmSfBY=5N+k-caaZ0TZhg6yZ_SWR_aA@mail.gmail.com> <CAChr6SzD8qdETafQKKU41BcYayTWf+C4GENd9FNzy5JYOv5jRQ@mail.gmail.com> <CAHBU6isx5aB94U-vn_t6GGoQ9W+ATDNYR6_+CtXgOhFho5Qh-g@mail.gmail.com> <20190529144005.GC11773@localhost> <CAD2gp_QELt-3=wqA1gRafNim8Y6fsxZ6hcQmTsoOxCSxU8eM1Q@mail.gmail.com> <20190529201716.GD11773@localhost> <DD0F8B7F-3D78-43B0-9A92-9D02FFBDC516@tzi.org>
In-Reply-To: <DD0F8B7F-3D78-43B0-9A92-9D02FFBDC516@tzi.org>
From: Ulysse Carion <ulysse@segment.com>
Date: Wed, 29 May 2019 17:07:31 -0700
Message-ID: <CAJK=1RhEvgQUdzZnGSmnYYdaLyoDVceQ6gPmDziE2ufYLzYzbw@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: Nico Williams <nico@cryptonector.com>, John Cowan <cowan@ccil.org>, Tim Bray <tbray@textuality.com>, JSON WG <json@ietf.org>, Rob Sayre <sayrer@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000d03aff058a0faf55"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/6DrZvRFh1c7N18w4kEM7A5z9nbg>
Subject: Re: [Json] A minimal examplotron-style JSON validation language.
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 30 May 2019 00:07:46 -0000

Hi Carsten,

Any thoughts on Tim Bray's suggestion? Regarding something akin to JSL (+
enums + timestamps), but perhaps built atop the foundations of CDDL?

- Ulysse

On Wed, May 29, 2019 at 2:15 PM Carsten Bormann <cabo@tzi.org> wrote:

> On May 29, 2019, at 22:17, Nico Williams <nico@cryptonector.com> wrote:
> >
> >  top_level : choice(file_menu, edit_menu);
> >  file_menu : object{"menu"->file_menu_contents};
> >  edit_menu : object{"edit_menu"->edit_menu_contents};
> >  file_menu_contents := object{
> >    "id":"file", /* this means this must be present with this value */
> >    "value":"File",
> >    "popup": object { ... }
> >  };
>
> While it is certainly enjoyable to design another language, I’m not sure
> why this should not be done in an ABNF-like syntax such as CDDL (which, by
> the way, is in AUTH48 and will soon be RFC 8610).
> Keeping your names (even the snake case, where I’d be using kebab case):
>
> top_level = file_menu / edit_menu
> file_menu = { menu: file_menu_contents }
> edit_menu = { edit_menu: edit_menu_contents }
> file_menu_contents = {
>   id: text    ; assuming here this is your examplotron content
>   value: text
>   popup: { }
> }
> edit_menu_contents = { }
>
> I didn’t put in the ignore-unknown stuff; that would be 12 characters in
> CDDL unless you define something to make this shorter.
>
> Put the above into a menus.cddl and try
>
>   cddl menus.cddl g 10
>
> you get 10 examples:
>
> {"menu": {"id": "gray", "value": "commixt", "popup": {}}}
> {"menu": {"id": "proctoplasty", "value": "compunctious", "popup": {}}}
> {"menu": {"id": "taglike", "value": "valvulate", "popup": {}}}
> {"edit_menu": {}}
> {"menu": {"id": "uninundated", "value": "unworthily", "popup": {}}}
> {"edit_menu": {}}
> {"edit_menu": {}}
> {"menu": {"id": "Orangeist", "value": "imperialin", "popup": {}}}
> {"edit_menu": {}}
> {“edit_menu": {}}
>
> This is a bit boring as there is only one choice and two non-singleton
> types.
> Sorry if I didn’t get the intent of your example right.
>
> Grüße, Carsten
>
> PS.: OK, with ignore-unknown:
>
> top_level = file_menu / edit_menu
> file_menu = { menu: file_menu_contents _..._ }
> edit_menu = { edit_menu: edit_menu_contents _..._ }
> file_menu_contents = {
>   id: text    ; I'm assuming here this is your examplotron content
>   value: text
>   popup: { _..._ }
>   _..._
> }
> edit_menu_contents = { _..._ }
>
> _..._ = ( * text => any )
>
> ➔
>
> {"menu": {"id": "fahlerz", "value": "unshocked", "popup":
> {"astrophotometry": "perdurance"}, "foolship": "pentacosane", "larrikin":
> "myoglobin"}}
> {"edit_menu": {"priggery": "cordaitean", "jackpudding": "righten",
> "unconfidence": "photolitho", "reviling": "ewe"}, "allophylic": "compound",
> "teacupful": "allergen"}
> {"menu": {"id": "amazement", "value": "condylomatous", "popup":
> {"cosounding": "share", "contribute": "gabblement", "gunpaper":
> "dividualism", "undersociety": "noration"}}}
> {"edit_menu": {"glareole": "clicket", "madling": "dizain"}, "scrimpily":
> "gypsywort", "neurofibrilla": "discolor"}
> {"edit_menu": {"unpermissive": "cockneity"}, "caudillism": "visa",
> "interloop": "anthracnose"}
> {"menu": {"id": "blankite", "value": "puffery", "popup": {"katuka":
> "Gnathostomata", "effeteness": "unspelt"}}, "Chaldaic": "extrafoliaceous",
> "trimesic": "dwindlement", "successful": "fluctuant", "nevadite":
> "aggradational"}
> {"menu": {"id": "acrostolion", "value": "devocalize", "popup": {}},
> "cymation": "premanufacturer", "mysticete": "analyst", "ethnocentric":
> "Myrtales"}
> {"edit_menu": {"glycerolize": "blastoid", "undisputedness":
> "propheticly"}, "orchiotomy": "illiquidity"}
> {"menu": {"id": "tenebriously", "value": "guardo", "popup": {"abeigh":
> "fibrillar", "Sminthurus": "disnosed", "accessibility": "autem"}}}
> {"edit_menu": {"stableman": "erosional"}}
>
>
>
>