Re: [Json] JSON Schema Language

Anders Rundgren <anders.rundgren.net@gmail.com> Wed, 08 May 2019 04:40 UTC

Return-Path: <anders.rundgren.net@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 1998F12011F for <json@ietfa.amsl.com>; Tue, 7 May 2019 21:40:26 -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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=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 V4SmgWBKhvar for <json@ietfa.amsl.com>; Tue, 7 May 2019 21:40:24 -0700 (PDT)
Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (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 DDA34120052 for <json@ietf.org>; Tue, 7 May 2019 21:40:23 -0700 (PDT)
Received: by mail-wm1-x344.google.com with SMTP id o189so1402992wmb.1 for <json@ietf.org>; Tue, 07 May 2019 21:40:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RiYOhMvYVlsLrzRv7PvvltQRokwSJgSXmBgB2NWkdII=; b=LIKhLj+oeR2p4ZMStAB8SyfXBmU5BjHOlg+XwpRcUkAqsdxBWHN7TKQmtX71ZzJp3X NYS3kLu8klZ0xBO4Gi7IYNphWhX1bIsbYVvVH3bK+iu2phAKfTqEy6bxaQiz7zn1kCjn F1MYDINM6E7rzA/xEQqETI0fjv4xWqe96ikuBlbLBTcZx4qO6rahWCAClCL6uOhia670 ps1DndAU1rmipCSYKMhx6fb4KorO3xhghdzyvXCsxkhCpIPIhLhvTF+QpSpgTB03BqxO LVQNjiKtlNi/l9ADe/1AR1uxnh0lHGZQDaWnNHoDGrf0W6swQlPtRnw/M0DEoxMExNmC 3AoQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RiYOhMvYVlsLrzRv7PvvltQRokwSJgSXmBgB2NWkdII=; b=I82kk2Yqt45E4QkoBs4Iae3fcgfhTTJtQ79im+jMBo8kBBWLeWGmjyfIluOmQxR7l/ J+zqDv54U5eIcGp5jX9BeDHhKdMFb8i/r5qI4kk7Vxe5ps55PV+qL29YUSOchqFwtw3B hOqQnUvTymMG91s4ZHEZKN0OoWSt4l3hh9utAQNKYSex5SpqhzDtnk1NY1WrHMveyepe 1uOqGjgrZC/wwtmjqMUl00+xPBKI9DDZiltFX24HpbcsW+sGuDtZNr9KGN1uvSJ5YBdb BpjrwKukzTsGbyYNFocmGegMWGJTeVE/CiXBjBmcs4njEe7D7K6e+h5k9r2w1KM0o6Q9 8Atg==
X-Gm-Message-State: APjAAAVA5AQKtFOS1o6RE1rQUm9fKaZe5UJ9/ecc9nULELvjyHphJJaE 8obmqdm6yPe8wZJvA5glmmJRVG9BCXs=
X-Google-Smtp-Source: APXvYqwmULvXFt8zMqZmBs8CUAv30VOOplQnKMvxAJAb+29E7g7dJAuLZfG6N45ScH8yHWaeDMU4Rw==
X-Received: by 2002:a1c:f616:: with SMTP id w22mr1244858wmc.28.1557290421758; Tue, 07 May 2019 21:40:21 -0700 (PDT)
Received: from [192.168.1.79] (25.131.146.77.rev.sfr.net. [77.146.131.25]) by smtp.googlemail.com with ESMTPSA id o130sm886449wmo.43.2019.05.07.21.40.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 21:40:20 -0700 (PDT)
To: Ulysse Carion <ulysse@segment.com>
Cc: Austin Wright <aaa@bzfx.net>, JSON WG <json@ietf.org>
References: <CAJK=1RjV1uv0eOdtFZ8cKn-FfCwCiGP5r2hOz1UamiM6YV4H1A@mail.gmail.com> <CAHBU6itE8kub1qtdRoW8BqxaOmzMv=vUo1aDeuAr3HX141NUGg@mail.gmail.com> <77994bdb-a400-be90-5893-b846a8e13899@gmail.com> <20190507154201.GP21049@localhost> <CEF72901-5077-4305-BA68-60624DCE952D@bzfx.net> <69ea0c99-e983-5972-c0aa-824ddeecb7c4@dret.net> <CAMm+LwjyVjnJuWE4+a9Ea=_X1uuEGuK+O4KojzN3uVQ+s+HqUQ@mail.gmail.com> <058f58a3-dd27-998e-5f54-4874aff5f2f0@dret.net> <20190507221726.GR21049@localhost> <CAJK=1Rj7PBD-bbwvsqgjQQzp4Aoidb-W2q5Lj6asMHHDHaTVYQ@mail.gmail.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <702ee54b-9465-7ca8-b521-2a88c1a47785@gmail.com>
Date: Wed, 08 May 2019 06:40:14 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <CAJK=1Rj7PBD-bbwvsqgjQQzp4Aoidb-W2q5Lj6asMHHDHaTVYQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/z8_ibK0x5z214sfWfPyYc8QMBPs>
Subject: Re: [Json] JSON Schema 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: Wed, 08 May 2019 04:40:26 -0000

I believe I have stated my opinion but here it is again:

The idea is not changing JSON in any way but to add *strictness* to its interpretation.

This has ZERO impact on JSON parsers but could in some cases affect JSON serialization.

There are no problems defining a set of numeric types having a range and syntax that conforms to what is the norm for most programming languages since all of that fits nicely into JSON.

However, assuming that any JSON parser also could be used for *implementing* JSL (including verifying arbitrary input data) will set the bar way too low.

Regarding the integer discussion I believe Open API/Swagger which has quite an active and big user community already flags 3.0 as an invalid integer.  A bug report on Open API (or on Jackson) would most likely return "works as intended".

There's more, but I leave it there.

Anders



On 2019-05-08 01:57, Ulysse Carion wrote:
> Hi all,
> 
> I'd like to offer a summary of what has been stated thus far, so as to
> make a bit more sense of the conversation.
> 
> 1. Considerable ink has been spilled on the question of integers in a
> schema language. The main question has been how such an integral
> constraint should relate to serialization.
> 
> 2. Some have raised questions around the terseness of JSON Schema and
> JSON Schema Language. Proposed alternatives are JCR and CDDL, by their
> respective editors.
> 
> On the first question, I would agree with Messrs. Bormann and Bray,
> who both suggest that a generic JSON parser runs first, followed by a
> second pass over the data to convert the parsed data in the context of
> a schema. On such a view, "3" and "3.0" are typically
> indistinguishable by the time the schema is taken into account.
> Bormann aptly notes that the alternative runs the risk of de facto
> forking JSON itself. I don't think there is much more to be said on
> the matter.
> 
> The second question is perhaps more interesting, although it has
> provoked less discussion. I went with JSON as the representation
> because it makes building tooling atop of JSON Schema Language much
> easier, since it doesn't require that the implementor write a parser.
> Such ease of extension is valuable: JSON is widespread largely because
> of how easy it is to build atop of, and we should not readily
> sacrifice this. JSON as the representation also unlocks syntax
> highlighting, formatting, and other such niceties for free.
> Furthermore, and most importantly, using JSON as a representation does
> not preclude later creating a RELAX NG-style compact representation
> later on.
> 
> I would also like to echo Bray's point about the real-world utility of
> such a system. My day-job involves APIs, event-sourcing, and analytics
> messages. In all three, JSON is the lingua franca, and in all three
> considerable tedium is involved in writing and maintaining validators
> and language-idiomatic containers for JSON messages. No
> language-portable solution to this problem exists today, short of
> moving away from JSON toward something like Protobufs or CBOR.
> 
> I'd like to return to the initial question of this thread, this time rephrased:
> 
> Are we in agreement that the question of describing JSON, and from
> that description generating validators and idiomatic
> classes/types/etc, is a problem worth solving?
> 
> Are we in agreement that something along the lines of the proposed I-D
> may be a way we address this problem?
> 
> Best,
> Ulysse
> 
> On Tue, May 7, 2019 at 3:17 PM Nico Williams <nico@cryptonector.com> wrote:
>>
>> On Tue, May 07, 2019 at 02:56:10PM -0700, Erik Wilde wrote:
>>> On 2019-05-07 14:48, Phillip Hallam-Baker wrote:
>>>>      at the risk of referring to XSD too much, but i think they got it right:
>>>>
>>>>      - constraining facets for constraining the value space.
>>>>      - lexical facets for constraining the representation of values.
>>>>
>>>> I disagree on the constraining facets part. The only values I have found
>>>> useful to put in a schema are 0 or 1 minimum occurrences and 1 or
>>>> infinity maximum occurrences.
>>>
>>> there may be a misunderstanding here. constraining facets are limiting the
>>> value space of datatypes, for example by defining minimum and maximum
>>> values.
>>
>> As long as they don't constrain the encoding when multiple
>> representations are available.
>>
>> _______________________________________________
>> json mailing list
>> json@ietf.org
>> https://www.ietf.org/mailman/listinfo/json