[Cbor] Record proposal

Carsten Bormann <cabo@tzi.org> Wed, 05 May 2021 05:04 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6B2363A0B9F for <cbor@ietfa.amsl.com>; Tue, 4 May 2021 22:04:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.219
X-Spam-Level:
X-Spam-Status: No, score=-4.219 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=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 A9g39HuIHwCH for <cbor@ietfa.amsl.com>; Tue, 4 May 2021 22:04:47 -0700 (PDT)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D560E3A0B9E for <cbor@ietf.org>; Tue, 4 May 2021 22:04:46 -0700 (PDT)
Received: from smtpclient.apple (p548dcb12.dip0.t-ipconnect.de [84.141.203.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4FZl4s2jm7z10BJ; Wed, 5 May 2021 07:04:45 +0200 (CEST)
From: Carsten Bormann <cabo@tzi.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\))
Date: Wed, 05 May 2021 07:04:44 +0200
Cc: Kris Zyp <kriszyp@gmail.com>
To: cbor@ietf.org
Message-Id: <8421F43D-E9ED-444F-A915-415F3AE59FA0@tzi.org>
X-Mailer: Apple Mail (2.3654.80.0.2.43)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/IEfXAOBMYPfA8s5UACxCUNk0ddU>
Subject: [Cbor] Record proposal
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 05 May 2021 05:04:51 -0000

Kris Zyp put together a proposal for adding tags for records:

https://github.com/kriszyp/cbor-records

Note that this has some of the problems alluded to in…

https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4-10

…which could be solved here (usage mostly in arrays) by defining a partial order that the usage of the tags defined on the fly would need to follow.

As Kris pointed out, my visceral reaction (below) has the limitation that it would only work for homogeneous arrays of records (and you have to ascertain homogeneity of the whole array before tagging).

Let’s have a quick discussion in the meeting later today.

Grüße, Carsten


JSON example:

[
   { "name": "one", "value": 1 },
   { "name": "two", "value": 2 },
   { "name": "three", "value": 3 }
]

Potential representations:

TBD([[“name”, “value”],
    [“one”, 1], [“two", 2], [“three", 3]])
(“CSV style”)

TBD([[“name”, “value”],
    [[“one”, 1], [“two", 2], [“three", 3]]])
(“Explicit”)

TBD([[“name”, “value”],
    [“one”, 1, “two", 2, “three", 3]])
(“Tight”)

TBD([[“name”, “value”],
    “one”, 1, “two", 2, “three", 3])
(“Too tight”)