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

Anders Rundgren <anders.rundgren.net@gmail.com> Fri, 10 May 2019 08:34 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 25B36120113 for <json@ietfa.amsl.com>; Fri, 10 May 2019 01:34:35 -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 jhIivRxNv0yB for <json@ietfa.amsl.com>; Fri, 10 May 2019 01:34:33 -0700 (PDT)
Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 C975A120194 for <json@ietf.org>; Fri, 10 May 2019 01:34:32 -0700 (PDT)
Received: by mail-wm1-x32f.google.com with SMTP id h11so6409136wmb.5 for <json@ietf.org>; Fri, 10 May 2019 01:34:32 -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=Fs38wufHhoJvm1e9sRuqW3qY9+25E614Xdr6SUAqEoY=; b=Bc9bGfg/mTJ/5sO3yQALUYeHFzQ/sA/ng0fr4yCve6hy9ylaYFJ3cUyf7mNEM2Ya3U mcJDoakOkg7vUy1Cqec7ukpnbWBLZ+DcMPbJR44ajtDn818l6dKnv2dczaOEFrUJhknB AjU2OWn55Jq4f1esx6wPj+aLGbmkuV+IGfWTHXZSy+uSQksrZSzWVjyDYWkuJ8v6nIOn J/QiV8foQasEC3Vfx07eMEOVGQhZthAfFF3PkL61n89n4JsOw5pc5nN2YfXgW4r+R69v FLsQDGqCbsl83W1uUOAOOVGL2iWiZlvojJhaRPkskJM31R1RkrWSinIsC7yY2Cow81r5 lhsQ==
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=Fs38wufHhoJvm1e9sRuqW3qY9+25E614Xdr6SUAqEoY=; b=f3geuwodpKm2pbbSa43gA15XqSYJFpARy/PhF8tRjmRu1E+jo0gAp5FqFxlzVihXKq opv889ZwDgj8RcMjF3dCxihoQwjVeBqBZltVfLvGX8r+bcIl17S5nwh0w7alG8kTHkvq YTWZtZQneBnSKm1JES0tgJO+cIVnaDXfE0eaL74/BZOIFNqDGTsioBq1sV0SSlJLPC64 +y4lf1tFWiyGHEaWv+h99xsXFu1Kw+AWQfcITXcnlGxOcEA05ZLbqargDA04qgMfrBe/ 5tz3x1GasI2sf3ucTMhgOiKJIadT8cU65REBe0ZWteG1Qnw30iCICXviqnqFJUenOESR ro4Q==
X-Gm-Message-State: APjAAAXhnYdAc7yWcoDmraTmTJ8BuYMoTLOAHxlyc5GguQyXfgQlS4kg Epl/aOneDWWoEt9C1mL94Qx/mIx2/cQ=
X-Google-Smtp-Source: APXvYqxhRV+wVJWfM6rfrbJHTrplqvgHOwQfsoBgej0WuJ8IwzPlIwQXvO5+AgOH0U7IYiE2bgc1qQ==
X-Received: by 2002:a1c:f901:: with SMTP id x1mr6284411wmh.136.1557477270922; Fri, 10 May 2019 01:34:30 -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 a128sm165777wma.23.2019.05.10.01.34.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 01:34:30 -0700 (PDT)
To: "Manger, James" <James.H.Manger@team.telstra.com>, Austin Wright <aaa@bzfx.net>, Carsten Bormann <cabo@tzi.org>
Cc: JSON WG <json@ietf.org>
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> <92D865C6-9990-46B1-961E-2DDD7D06617C@bzfx.net> <MEXPR01MB09341A56C01F2BAB1BD195A5E50C0@MEXPR01MB0934.ausprd01.prod.outlook.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <71a71f7a-128f-439f-e44f-fbb5cfc16ec3@gmail.com>
Date: Fri, 10 May 2019 10:34:27 +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: <MEXPR01MB09341A56C01F2BAB1BD195A5E50C0@MEXPR01MB0934.ausprd01.prod.outlook.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/8iL6KlD5HQCYOxSAeOXBmrunvDk>
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 08:34:35 -0000

On 2019-05-10 09:56, Manger, James wrote:
>> “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.
> 
> NO WAY!
> RFC8259 JSON explicitly says when keys in an object are not unique the behaviour of parsers is unpredictable. So it you specify a system that gives meaning to repeated keys then lots of JSON parsers will be unusable in this case. Hence, it is harmful to call that JSON, call it "ECMA 404 syntax without normal JSON semantics".
> 
>> 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.
> 
> The number of elements in a JSON object and the number of headers in an HTTP message are both theoretically unbounded. But there is a strong assumption that the latter (#headers) is limited: typically 10s, perhaps 100, never 1000s. Web servers limit total header size to, say, 8KB. That is small enough to always handle repeats. While many JSON objects will also be small, JSON is such a generic format that you cannot make a global assumption that JSON objects will always be small enough to hold in memory. Hence some apps will need streaming JSON processors that cannot reasonably detect duplicate keys (so the "SHOULD" is there to accommodate these).
> 
> 
>> 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.
> 
> RFC8259 JSON does have that text. For example, "good interoperability can be achieved by implementations that expect no more precision or range than [64-bit floats] provide"; "when the names within an object are not unique, the behavior [...] is unpredictable".
> 
> For more concrete text, use RFC7493 I-JSON (Internet JSON is a restricted profile of JSON).

Right on!  I have "hammered" a bit on Oracle who interpreted I-JSON "literally" making small BigIntegers serialize as Number and big such as String which probably breaks most schemas.

They now seem to have come to their senses:
https://github.com/eclipse-ee4j/jsonp/issues/160

Oracle do not support duplicate keys either.  If you want to use such you are probably not really a candidate for using a schema.

JSON is slowly but surely getting better :)

thanx
Anders

> 
> --
> James Manger
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>