Re: [Json] Update Standard to support ECMA-262 BigInt

Pete Cordell <petejson@codalogic.com> Tue, 04 May 2021 10:11 UTC

Return-Path: <petejson@codalogic.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 02EF73A2E3B for <json@ietfa.amsl.com>; Tue, 4 May 2021 03:11:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, NICE_REPLY_A=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 WY7YzOmjRbdv for <json@ietfa.amsl.com>; Tue, 4 May 2021 03:11:18 -0700 (PDT)
Received: from ppsa-online.com (ppsa-online.com [217.199.162.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CEE003A2E3A for <json@ietf.org>; Tue, 4 May 2021 03:11:17 -0700 (PDT)
Received: (qmail 4866 invoked from network); 4 May 2021 11:11:14 +0100
Received: from host31-49-16-155.range31-49.btcentralplus.com (HELO ?192.168.1.72?) (31.49.16.155) by lvps217-199-162-217.vps.webfusion.co.uk with ESMTPS (TLS_AES_128_GCM_SHA256 encrypted, authenticated); 4 May 2021 10:11:14 -0000
To: Carsten Bormann <cabo@tzi.org>, Daniel P <danielaparker@gmail.com>
Cc: JSON WG <json@ietf.org>
References: <CA+mwktLWwDRYtF9BFSRnF4e7_v=e3F4HERS5yHptSksxGBysnQ@mail.gmail.com> <F1A006F9-8743-4930-B879-F83339A38485@tzi.org>
From: Pete Cordell <petejson@codalogic.com>
Message-ID: <9e811395-2f56-f2b2-b4a6-c686544cb1ef@codalogic.com>
Date: Tue, 04 May 2021 11:11:14 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <F1A006F9-8743-4930-B879-F83339A38485@tzi.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/rnN8UEM8bl5Mb5vHg8CLl0TrSiU>
Subject: Re: [Json] Update Standard to support ECMA-262 BigInt
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, 04 May 2021 10:11:24 -0000

On 30/04/2021 21:53, Carsten Bormann wrote:
> On 30. Apr 2021, at 21:36, Daniel P <danielaparker@gmail.com> wrote:
>>
>> Do you mean in the context of a schema specification?
> 
> CDDL (RFC 8610) can already do much of what is probably needed here.
> If there is anything else to be added, CDDL has an extension point (control operators) that is rather flexible.


Hi Daniel and Carsten,

I was speaking in very general and abstract terms.  More along the lines 
of "one could imagine that ..." with no specific work item in mind.

But....

Since you raise the issue of JCR vs CDDL, here are my thoughts...

Firstly, Carsten, do you or anyone else knows of any IETF WGs using CDDL 
to define JSON data?

As for what I think JCR offers that I don't think CDDL currently offers:

1.
JCR has a simple way to combine multiple rulesets.  In one ruleset you 
might have:

    #ruleset-id org.ietf.example1

    $foo = int32

Then in another ruleset:

    #import org.ietf.example1 as ex1

    {
       "id" : $ex1.foo
    }

Here, $ex1.foo refers to $foo defined in the ruleset with id 
org.ietf.example1.


2.
Although possibly not formally released, we were considering a way of 
declaring that a string had to adhere to an arbitrary format.  This was 
a way of adding additional string based types (as there is no other 
option in JSON for extended types!) without adding new base types (like 
int32, date-http etc).  So, in a ruleset you could specify something like:

    #ruleset-id org.ietf.extended-types

    $rfc2822-date-time =
          @{format org.ietf.extended-types.rfc2822.date-time} string

Then use it as:

    #import org.ietf.extended-types as iet

    {
       "start-time" : $iet.rfc2822-date-time,
       "end-time" : $iet.rfc2822-date-time
    }

The spec for the "org.ietf.extended-types.rfc2822.date-time" format 
might read something like:

    Formatted according to the RFC2822 date-time ABNF but omitting
    the trailing [CFWS] term.

So, "org.ietf.extended-types.rfc2822.date-time" is not machine 
resolvable to a specific format on its own.  It is just an opaque 
character string used as an identifier for the format.  A validator 
would either know about strings formatted according to 
"org.ietf.extended-types.rfc2822.date-time" (possibly via inbuilt hard 
coding or using some plugin arrangement) or just issue a warning saying 
I don't know what the format "org.ietf.extended-types.rfc2822.date-time" 
is so I'll check it is a string but leave it to other layers to verify 
that it is the right format.

Such a feature may not be something so useful for CBOR but I think it is 
very useful for JSON strings.

In conclusion, I need to revisit things in more detail, but currently my 
gut feeling is that if those sorts of features are supported in CDDL, it 
would be worth adopting CDDL for JSON format specification.  Primarily 
because it has a formally published spec!

Many thanks,

Pete.
-- 
---------------------------------------------------------------------
Pete Cordell
Codalogic Ltd
C++ tools for C++ programmers, http://codalogic.com
Read & write XML in C++, http://www.xml2cpp.com
---------------------------------------------------------------------