Re: [Cbor] Consolidated set of tags for map-like entities

Emile Cormier <emile.cormier.jr@gmail.com> Mon, 15 March 2021 20:09 UTC

Return-Path: <emile.cormier.jr@gmail.com>
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 79E773A0D85 for <cbor@ietfa.amsl.com>; Mon, 15 Mar 2021 13:09:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, 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 Ngxr6Nh8pMo1 for <cbor@ietfa.amsl.com>; Mon, 15 Mar 2021 13:09:48 -0700 (PDT)
Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (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 968353A0D81 for <cbor@ietf.org>; Mon, 15 Mar 2021 13:09:48 -0700 (PDT)
Received: by mail-pg1-x533.google.com with SMTP id o16so4141838pgu.3 for <cbor@ietf.org>; Mon, 15 Mar 2021 13:09:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7tiYPkNbOHwWyzd9TiHjXL2TpdwEYCFNku+e/RgIg/E=; b=R72V6wBa9W3JHAV9tthUfFKm9ZpBw/6YhCEcyUGHtn3RdgXSHTUxi7B0vokc4nF0sv lBbBZHOhKt1yFVfEvcpj5NR1kkCr3BZfpjWqw4uV2HxLanEP/HtNnvObcWCVDf22d9Vs /YZ9j1DVcIwObGclUQr5ZG26vdVPnR3QSZ/bdxbevAwtpA8UraHTBMrognO7A7yr+E7f Z9Q7BlZmsz7j8jogBz3RJdG0b8TlN+/uTF+YhFZJlWrWiMc7tj59W+cAU3q75XopNBMX k2dxsnnml3aC06VNIvJ65Q8x56Jzb/0/o4Fcgn5U/3qGoflnAP8l+qeLpf9f3DdgXoxk R8sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7tiYPkNbOHwWyzd9TiHjXL2TpdwEYCFNku+e/RgIg/E=; b=uDXa4EjeDBF0b1cpst2+/En2UKu925OD2uav3Va2T4JQL6CQ9RVQ0ZaROaqUA/jB78 P1ZOZV7SsXReyaoAn7t5MR4HiN9VsPdwMfj1G4ZPNrByo/KA2pz+D5fhGucgCK0fJm1h Fgdt4hfRzOqAjtpZ7IYGu3POFRN8k+1E5mccpzgNTQfgYuKcSp0SFdXkhNO87IhFcsJ5 lBL50pE1l8BjDGhXyMwF1FG8JPijwGYADYaokTJIuD5SPJPxy8A5WjEj6YM44dqyVDw3 ylE215PXFIflHvfFTt+fCO6XQRIcfgmiHI6Kv6yEZfGKecdiEG9RftsFrn6UT074x1rw AFqw==
X-Gm-Message-State: AOAM533d+5teLbVFbXAcwG4AyUqbZ8puVNnVs0As4rz5BNSaD61lq8Jv 11liRHgz9n6eihfg5OzBoI4qgaVLhsQ0WhI5hDqZSQS5oMU=
X-Google-Smtp-Source: ABdhPJzQBoMNn5rTmySrYcxm4A4TOpIMG5NBHMOR17cSbDOIMDA4L2EgJBS71ttHYhTxBQFcqEUr2cK/aJa1jyq3X0s=
X-Received: by 2002:a63:b12:: with SMTP id 18mr701353pgl.45.1615838986584; Mon, 15 Mar 2021 13:09:46 -0700 (PDT)
MIME-Version: 1.0
References: <CAM70yxC7o3CNz67Yx3-yLt3tPQaTRaezOO99Ssa-3ppu-NwD=Q@mail.gmail.com> <C2B0934A-2AAB-4A45-A354-407782B4CA0B@cursive.net> <FA5E389C-C577-4D42-A19E-A3A50F14F730@tzi.org> <16642498-C82F-41CE-A06D-6C762AEEB6F9@cursive.net>
In-Reply-To: <16642498-C82F-41CE-A06D-6C762AEEB6F9@cursive.net>
From: Emile Cormier <emile.cormier.jr@gmail.com>
Date: Mon, 15 Mar 2021 17:09:35 -0300
Message-ID: <CAM70yxC3px4U_aVv0yNNL8t-m+Vt3ftLKvUfhsCNHS2sqzM5Fg@mail.gmail.com>
To: Joe Hildebrand <hildjj@cursive.net>
Cc: Carsten Bormann <cabo@tzi.org>, cbor@ietf.org
Content-Type: multipart/alternative; boundary="000000000000cf442b05bd98d46b"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/zQLs_dLdkFNVNAUtZVSgk8tfSCg>
Subject: Re: [Cbor] Consolidated set of tags for map-like entities
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: Mon, 15 Mar 2021 20:09:50 -0000

I don't know anything about "mt5", but with my proposed tag set, you could
check for the presence of tag 132 (homegenous key) and you would know after
decoding the first key if all the key-value pairs can be safely decoded
into a JS Object. Of course, this requires that the sender "play along" and
actually bothers to use the tags.

On Mon, Mar 15, 2021 at 4:44 PM Joe Hildebrand <hildjj@cursive.net> wrote:

> > On Mar 15, 2021, at 12:51 PM, Carsten Bormann <cabo@tzi.org> wrote:
> >
> > On 2021-03-15, at 19:50, Joe Hildebrand <hildjj@cursive.net> wrote:
> >>
> >> Data Item being major type 5 should really only be used if the keys are
> homogeneously strings, in my opinion.
> >
> > We are using a lot of integer labels with mt5, so why would we make that
> restriction?
>
> This is a consequence of my implementation that others probably don't
> have.  When decoding mt5, I always keep a set of [key,value] tuples until
> all of the items have been decoded.  Then, if the keys are all strings, I
> convert the tuples to a JS Object, otherwise I convert them to a Map.  If
> I've already converted to a Map in mt5 processing, it's too late to (for
> example) throw an error if there is an unexpected duplicate key.
>
> —
> Joe Hildebrand