Re: [Json] JSON Schema Language: extensibility and unspecified properties

Ulysse Carion <ulysse@segment.com> Tue, 13 August 2019 05:04 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 A841512007C for <json@ietfa.amsl.com>; Mon, 12 Aug 2019 22:04:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 ZVrY3bxZYvoW for <json@ietfa.amsl.com>; Mon, 12 Aug 2019 22:04:07 -0700 (PDT)
Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) (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 2AC41120073 for <json@ietf.org>; Mon, 12 Aug 2019 22:04:07 -0700 (PDT)
Received: by mail-ot1-x336.google.com with SMTP id f17so32462947otq.4 for <json@ietf.org>; Mon, 12 Aug 2019 22:04:07 -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:content-transfer-encoding; bh=dkL4baXQTL2J9pEhS+Gps1ALW6gKZaE4iEE/vMvG884=; b=N6oy14skCVuEYKGP0Y3bgDb7ChkngHT0gR4iQtjOKCLpUMVUXUKxD0WR+5xIusxIY8 8+JSJVVG/qzmi8ExAnGhrdimnDTB/PZxrQPm9fxlKg1OXgpMKnpvtOa3ftwNiK0xk0Bk 7xCw16KffqL+tr2ZDSeU1CmQ7rxNmgI3AO0xY=
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:content-transfer-encoding; bh=dkL4baXQTL2J9pEhS+Gps1ALW6gKZaE4iEE/vMvG884=; b=gGtPIqbu+rz6ycAjaM5rtG9Vnp7K5FJc2oPZNsBdJJwwR02VSjoK824FYz0WLSvR/F 0MOFuPRP4N43swTlqDoQc+JvddD5iFI0fbQ5JHqYUrUzeaSIGCrt3ltxIE7T8cob7OEi uMQSp7rC0Xk0LdlsffE2v8AJMjAKmnG8OzFAvHkDhlracNSx+hQcwl0oKQF8YMRzJ5do 5xV+Aqpqu6ir9xwiFcKT/T9+HbWGfypjnnL5Vlk+rLJ0P3ZjhlZBe3xzoi/nNsrTf5jI LxHywZ2oUtaerp4XcWRfvfMS0Uxv2kz2AcC183dAzF3CBtRE8gHnmLjW7fldk99U4gW7 KjEg==
X-Gm-Message-State: APjAAAVZ2Wgf34MSGc+eRsYR5FJz44/6Mc4xrK/K5HbIAu76V9TOHRiB mm+KmV/S0QwvSuLEw04pU+/eFdHqI4ErAfK2aXRYEOMzeEw=
X-Google-Smtp-Source: APXvYqx8CiTMgskK8cp+/FP40ozN71s6cFR4BzL22RxydGtyYnm3iMcBlwYR0UajnJX3vud/OfSdDaNpWdD79KyziBA=
X-Received: by 2002:a02:952d:: with SMTP id y42mr16663626jah.66.1565672646198; Mon, 12 Aug 2019 22:04:06 -0700 (PDT)
MIME-Version: 1.0
References: <CAJK=1RhXp85cz-pOAQPw2JM=CYHgGSygj4Hw0spht56jbzQE2g@mail.gmail.com> <53094378-B559-49E1-B42B-54FBA8BC35AA@tzi.org> <CAJK=1Rj6Q3CvpF9aYML=47SF_XP49=O2hLhcBo8gZCb73C0RAw@mail.gmail.com> <FDB93E41-9D7D-4BF2-8D01-F4D075774848@tzi.org>
In-Reply-To: <FDB93E41-9D7D-4BF2-8D01-F4D075774848@tzi.org>
From: Ulysse Carion <ulysse@segment.com>
Date: Mon, 12 Aug 2019 22:03:55 -0700
Message-ID: <CAJK=1RiE_+nHkeB77DericN498w1v9mf2hsBgnQtgsZTVM9N9A@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: JSON WG <json@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/ww3rgmExJ4ndwF_LTo4ZrvW5t6E>
Subject: Re: [Json] JSON Schema Language: extensibility and unspecified properties
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: Tue, 13 Aug 2019 05:04:10 -0000

> However, it seems bizarre to support int8, int16, and int32, but not JSON’s generic interoperable integers.

Supposing we add int53 to JSL, do you picture code generators
producing int64_t/long for {"type": "int53" }? Does that mean that,
before serializing an int64_t to something marked as int53 in JSL, the
application must first do an extra bounds check? Today, it's fairly
easy to generate code from JSL where serializing is an infallible
affair. But with int53, that property would be lost, because most type
systems cannot express int53.

I'm inclined to think this is something better handled by extensions.
Perhaps someone can define a "intt53" property to do something like:

{ "type": "number", "int53": true }

The person writing the extension would document that the "int53"
property indicates whether a number is meant to represent a number in
the I-JSON range. Applications which don't understand this keyword
will still do something reasonable -- validate for some sort of
number, and code generate a "double" -- but applications which care
about this can handle this case specially. It also signals an intent
about how the number will be used.

I expect this sort of approach is how JSL may need to handle
big-number encoding schemes. There are so many different ways approach
that problem, and I think JSL is most useful if it establishes an
uncontroversial foundation, and then lets additional, out-of-spec
keywords tighten the schema further in a way which most folks don't
care about, and hence don't want to have to implement.

Does that seem like a reasonable approach?

> Actually, that’s something JSON can’t deal with.

By this you mean that JSON prescribes "all numbers are doubles", and
so integers aren't really a good thing to try to foist onto JSON's
syntax?

> MS-Excel has repeatedly taught me that my university phone number is 2.1863921e7, but people still manage to call me :-)

Could you expand what you mean here? I realize no joke is funny enough
to survive explanation, but I'm afraid I'm perhaps missing your point.

On Sun, Aug 11, 2019 at 1:06 PM Carsten Bormann <cabo@tzi.org> wrote:
>
> On Aug 11, 2019, at 19:33, Ulysse Carion <ulysse@segment.com> wrote:
> >
> >> This is a nice demonstration that it was a mistake to remove uint53.
> >
> > Perhaps. But perhaps instead I should just use {"type": "number"}, and
> > accept that JSL isn't going to be able to express certain things about
> > numbers?
>
> Sure, that is one way of handling it.
> However, it seems bizarre to support int8, int16, and int32, but not JSON’s generic interoperable integers.
>
> > Re-reading https://tools.ietf.org/html/rfc7071, it seems it constrains
> > the timestamps to not have a fractional part at the JSON syntax level.
>
> Oops.
> (I’d consider this an erratum, though, as Section 2.4 of RFC 4627 does not define “integer”.)
>
> > That’s another thing JSL can't deal with.
>
> Actually, that’s something JSON can’t deal with.
>
> > But I'm not sure if in
> > practice that’s such a big deal.
>
> MS-Excel has repeatedly taught me that my university phone number is 2.1863921e7, but people still manage to call me :-)
>
> Grüße, Carsten
>