Re: [Json] Adding integers to JSON (Re: JSON Schema Language)

Austin Wright <aaa@bzfx.net> Fri, 10 May 2019 06:40 UTC

Return-Path: <aaa@bzfx.net>
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 3873412017D for <json@ietfa.amsl.com>; Thu, 9 May 2019 23:40:26 -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_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=bzfx.net
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 gxP1FOGd4pSf for <json@ietfa.amsl.com>; Thu, 9 May 2019 23:40:24 -0700 (PDT)
Received: from mail-it1-x142.google.com (mail-it1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (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 06251120169 for <json@ietf.org>; Thu, 9 May 2019 23:40:23 -0700 (PDT)
Received: by mail-it1-x142.google.com with SMTP id l7so7447975ite.2 for <json@ietf.org>; Thu, 09 May 2019 23:40:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bzfx.net; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=k7TKeRLEdmAhqtgxbEPxVir4IJVyIWKEPBovyYBVdfA=; b=jgwHoq0HifN4VuiVlE5NRrjSmqarMCwJAH3lyMHoTMtbO7RzznG/wOP7RfKivFBVjj 3a2wYhG0OrC6bZMEkbwFWhFjUBKVcCIgjKVXCqB1uu4q6IMC+6wsBv+AAsmJjrUWfk/6 dHbZeDwvH7T8SBlaWPQXE64RkgzP+IgWadBjg=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=k7TKeRLEdmAhqtgxbEPxVir4IJVyIWKEPBovyYBVdfA=; b=sTv9FgnnioAXwzu9KQM4wlBri6otZgqIf5Q1aEVR/fusH35bI+V9dky3NdQwlp8sOv yLpCE3lFInlPAzRwaV6ixj+bBxu9lZjdHXA1ZORs0SMm4AgU5R5vagxqL7YbI2bczE2b CoJvExDnCAV59TcTjOWd7T1+nwwt32CGI+w6wuTFoa4UkJBefBvz/Qu8fzgUyGqbaYo6 EG6/0y2UjxbXkDtJKMTsTuZGyS8Jc4j9fsSPUul1cFaZIZTGBIjRDeo8MCEreRIwnYuU 6v+nGfx/9Kk/vAsfmIISmFcD5lCGf/MIGp2AeFZp5fOmtRRvuFDh7Z4jOhuh29RUci/7 bwfg==
X-Gm-Message-State: APjAAAV94bXdatJDqOtiKPSXcFPzicLS8RCoXcgFAZUNdp8lG/oYhUzA rPplP3q1Pi/C6bT3Vq6512Rhevjhi3w=
X-Google-Smtp-Source: APXvYqzd3KwiFQF/nbmYnJ0w64sqPeQp+TTTj/riqc2FcXsI0gCLYo2WVzumWc2DhSQryCF+fcMkyQ==
X-Received: by 2002:a24:248f:: with SMTP id f137mr5977516ita.112.1557470422992; Thu, 09 May 2019 23:40:22 -0700 (PDT)
Received: from [172.20.1.233] ([4.71.40.243]) by smtp.gmail.com with ESMTPSA id y62sm2115199ita.15.2019.05.09.23.40.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 23:40:22 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\))
From: Austin Wright <aaa@bzfx.net>
In-Reply-To: <B7EA86E6-A9F3-45FE-8436-2F36812C615B@tzi.org>
Date: Fri, 10 May 2019 00:40:21 -0600
Cc: JSON WG <json@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <92D865C6-9990-46B1-961E-2DDD7D06617C@bzfx.net>
References: <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> <702ee54b-9465-7ca8-b521-2a88c1a47785@gmail.com> <20190508160740.GU21049@localhost> <ACD9A0A2-A75E-4B6E-9E9B-165DC222781B@tzi.org> <02755092-1682-45E8-AB6C-0EDA7D35703A@bzfx.net> <B7EA86E6-A9F3-45FE-8436-2F36812C615B@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3445.104.8)
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/VKQA41omwHoyUlxETl3mhCIAnJs>
Subject: Re: [Json] Adding integers to JSON (Re: 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: Fri, 10 May 2019 06:40:26 -0000


> On May 8, 2019, at 23:50, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On May 9, 2019, at 00:49, Austin Wright <aaa@bzfx.net> wrote:
>> 
>>> Now people did not want to accept that.
>>> They wanted to extend the JSON data model with the distinction between two number types.
>> 
>> Who’s “they”?
> 
> Those people who want 3 and 3.0 to mean different things in a JSON document.
> 
>> Neither of these “extend" JSON, because JSON does not impose any requirements on how implementations parse numbers. My reading of RFC8259 allows implementations to differentiate between `3` vs `3.0` vs `3.00`.
> 
> The language that Section 6 of RFC 8259 has inherited is not very good.
> I cannot achieve a reading, though, that would support the above.

Well, JSON says that any number that fits the syntax is legal, and it doesn’t proscribe a way to normalize the numbers. And some software does keep track of significant figures. Why should those applications interpret JSON any differently?

> 
>>> — duplicate map keys for adding comments to JSON.  Some people believe:
>>> 
>>> { “postcode”: “This is a comment about the post code 4711”,
>>>  “postcode”: 4711 }
>>> 
>>> is a valid way to extend JSON with comments.  (Because their implementation happens to ignore map keys that are invalidly used again later, which is not a given.)
>> 
>> Certainly, this is not interoperable. But it is legal: RFC8259 merely says documents “SHOULD NOT” use multiple keys,
> 
> Please re-read RFC 2119.  SHOULD is a normative statement.  It is not a MUST mainly because streaming implementations would have a hard time properly implementing that prohibition, so they are allowed to occasionally malfunction.  But a malfunction it is.

“SHOULD" allows implementations to vary from the suggested behavior if there’s a reason. RFC8259 specifically says the reason is interoperability, and also says implementations might report all of the key-value pairs, even repeated keys. So if two implementations agree that repeated keys are meaningful, that seems legal to me.

I don’t see how the fact JSON can be streamed changes this. HTTP says servers must produce errors on some headers if they’re repeated; and HTTP is also parsed by streaming parsers.

Now, if the vast majority of JSON implementations don’t recognize excess precision, and don’t allow (or ignore) repeated keys, then maybe JSON should be updated to reflect that. Look at HTTP as an example, which is far more specific about how to handle these cases (e.g. repeated Host header, repeated Content-Length, media type q-values).

Cheers,

Austin.