Re: [Json] JSON Schema Language

Anders Rundgren <anders.rundgren.net@gmail.com> Mon, 06 May 2019 08:56 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 15EAD12011D for <json@ietfa.amsl.com>; Mon, 6 May 2019 01:56:05 -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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-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 oym1yh88ww4R for <json@ietfa.amsl.com>; Mon, 6 May 2019 01:56:03 -0700 (PDT)
Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 767D912006F for <json@ietf.org>; Mon, 6 May 2019 01:56:03 -0700 (PDT)
Received: by mail-wm1-x335.google.com with SMTP id f2so9257378wmj.3 for <json@ietf.org>; Mon, 06 May 2019 01:56:03 -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=Ml12/he804s/4XTnFwZhua9u8V+tA6rCq0oViorCiMc=; b=TkjnuQFK/f242WH0isE3QYgBJD/rkvLRjjriGiueAwyLaEr8ekUP9vGtjc6mlv3umA 0ARkUiWt8h9pNmlPTp7jWL1eMQm+GBXOz+VqDbR1ZfqxpPxFluiFcaeVGq709BQTkljz 9EX4CcXR61NxjrMNmx8QC9hJ3pcRHfVREvEbKrjn3yWNxzqyrYNpk5T9JxDRCFq+iyUA C2hfjLKEM67L16icLOlBL4G9cY0QhoH4ISgl8+NWPlGqjui3rsNBbt4KY97igyWAOyMo AxpGd+VZH3aaNWgSKWbzZQx7b/NsVK17XPv2eypKgjKnBcfYr2nPbySue0CGv5WRCK5R u03A==
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=Ml12/he804s/4XTnFwZhua9u8V+tA6rCq0oViorCiMc=; b=YVwfGyS+afpcOCd1XX6gA4aCETDql9qCm6kbWJinRIxYk03PMZyzL5s5MevioOphNl oFOO9GpW9x4kPrDn9V0DMIjXaLzcnQqxVYnY8fsaBDWmyQinFKUTqc6XHvTXb+pJRsLD ES4nxPYn5C7fbwRGJjorSjho8lfXjjtMzS0quH/WBxhGIDyVjQ1ZqUFRTnvQpQ+avNNT ye4TMQhG8idhYpZq8zHags7m+ZP/BYzwlCyCUjmYuOFDlvk7IIkoQTbfplXB+6RfrkhV 7rbF2gXiJQ/mo3cdkOc/FrcEMRAuuCdL2vbkhsW3EqLwMWERU9qPcS70Tfn5ZILQlA+6 Dl5Q==
X-Gm-Message-State: APjAAAUrLMZXCyzMZ473Q+CMj/rXW2LsProCS6a1gQl1JjUSw+nKhQ3Q GayEC4RvghVFq1M8ZaHDfuo=
X-Google-Smtp-Source: APXvYqxPtMU/nuZAklZQ4FEuhwyEGSah2/IO0Xs2XqGebae3HneMkbg12cxn9WHegHuWAfnyzyguWA==
X-Received: by 2002:a1c:c183:: with SMTP id r125mr14810058wmf.57.1557132961878; Mon, 06 May 2019 01:56:01 -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 b10sm20421444wme.25.2019.05.06.01.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 01:56:00 -0700 (PDT)
To: Austin Wright <aaa@bzfx.net>
Cc: json@ietf.org, Ulysse Carion <ulysse@segment.com>
References: <CAJK=1RjV1uv0eOdtFZ8cKn-FfCwCiGP5r2hOz1UamiM6YV4H1A@mail.gmail.com> <39682ec8-f993-a44c-d3e2-1638d2c1608f@gmail.com> <29CAE1CE-D6CB-4796-B2F2-2095BE921385@tzi.org> <AD5ABD9C-F5F2-477D-B862-529C890D5472@bzfx.net> <DA1767B8-22D6-4EA9-8112-4B36B79E9039@tzi.org> <D21B379B-23CC-48B3-BE10-D2777308E2E0@bzfx.net> <40f80ea0-d130-3f3b-39fa-2c84e802ed55@gmail.com> <35E2623E-753D-4918-8AF4-BF0BC5DE4868@bzfx.net> <6260354b-aca2-e001-7145-148b32658416@gmail.com> <9D90C1F1-6747-4373-93B0-8D51C5B25F1C@bzfx.net>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <3a438654-b1ef-ecbd-0fb2-937d8f40f0c9@gmail.com>
Date: Mon, 06 May 2019 10:55:56 +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: <9D90C1F1-6747-4373-93B0-8D51C5B25F1C@bzfx.net>
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/WJ8dy8bwrkwb16kMWSwaHvHonSI>
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: Mon, 06 May 2019 08:56:05 -0000

On 2019-05-06 09:22, Austin Wright wrote:
<snip>
> 
> Can you elaborate on this? My point is primarily concerned with JSON parsers, not JSON the media type.
> 
> Suppose a string were too large to store in memory, most ECMAScript engines would bail with an uncatchable error. The suggestion is to implement this more robustly, like throw an error if a string would be too long, or if a number has too many significant figures; instead of either crashing or silently approximating the number.

I don't understand this.  A JSON schema is a description of a JSON document.  If the description is incompatible with implementations that are supposed to parse compliant documents all bets are off.


> But also, why not build a parser that uses a schema to influence how values are parsed? Suppose you have a dynamically typed language, and want to parse some value, e.g. sometimes as an int, sometimes as a bignum, depending on the property. You might provide a JSON Schema to specify this behavior.

This sounds like an edge-case but it could be supported by an "any" type (although don't particularly see how this could work in a cross-platform scenario).

I would rather consider looking into more down-to-earth requirements such as supporting common numeric types and dealing with alternative already widely deployed serialization options for those.

https://github.com/json-schema-org/json-schema-spec/issues/736

Anders