Re: [netmod] RFC 7951 - JSON encoding of empty lists
Kent Watsen <kent+ietf@watsen.net> Tue, 29 March 2022 17:14 UTC
Return-Path: <0100017fd6abba70-36f5982f-085f-4c24-b0cd-35e90700b495-000000@amazonses.watsen.net>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1])
by ietfa.amsl.com (Postfix) with ESMTP id 70EEF3A1B45
for <netmod@ietfa.amsl.com>; Tue, 29 Mar 2022 10:14:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.906
X-Spam-Level:
X-Spam-Status: No, score=-1.906 tagged_above=-999 required=5
tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,
SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key)
header.d=amazonses.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 B140nf6Xy94H for <netmod@ietfa.amsl.com>;
Tue, 29 Mar 2022 10:14:14 -0700 (PDT)
Received: from a48-90.smtp-out.amazonses.com (a48-90.smtp-out.amazonses.com
[54.240.48.90])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))
(No client certificate requested)
by ietfa.amsl.com (Postfix) with ESMTPS id 76AAF3A1B2A
for <netmod@ietf.org>; Tue, 29 Mar 2022 10:14:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;
s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1648574053;
h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID;
bh=Fn/UDJXvin6CvFLWsSGHEcHXoNswZyav/sVTtP3tl9o=;
b=ATQxoE2/fTTG+52kVJuS/KVdrXgWzwLXrSvGxRCilZ6bog/wKAoP7kEyqZAWewtm
C9cvGoJNZwDa+cOpQl/hhR9WWWqIs23dBVH7YUhVOkbeu9m5rz5e6hNLdoHIGqj5iIe
AcmBB+eUNAev/iCjKgYg9FFc1sgvlexVrpg4/URY=
From: Kent Watsen <kent+ietf@watsen.net>
Message-ID: <0100017fd6abba70-36f5982f-085f-4c24-b0cd-35e90700b495-000000@email.amazonses.com>
Content-Type: multipart/alternative;
boundary="Apple-Mail=_C03037EE-429A-4E36-BE6B-4390DD3DC560"
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\))
Date: Tue, 29 Mar 2022 17:14:13 +0000
In-Reply-To: <HE1PR83MB03785D65431C5DF40FA08FEA881E9@HE1PR83MB0378.EURPRD83.prod.outlook.com>
Cc: "draft-ietf-netmod-yang-json@ietf.org"
<draft-ietf-netmod-yang-json@ietf.org>,
"netmod@ietf.org" <netmod@ietf.org>
To: Jack Rickard <jack.rickard=40microsoft.com@dmarc.ietf.org>
References: <HE1PR83MB03785D65431C5DF40FA08FEA881E9@HE1PR83MB0378.EURPRD83.prod.outlook.com>
X-Mailer: Apple Mail (2.3693.60.0.1.1)
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
X-SES-Outgoing: 2022.03.29-54.240.48.90
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/XANNDLxkWtSxaujZ3O_eBlHv82k>
Subject: Re: [netmod] RFC 7951 - JSON encoding of empty lists
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>,
<mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>,
<mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 29 Mar 2022 17:14:25 -0000
#1 is an empty list (or leaf-list). This is what you want. #2 is a list containing one element, which is an empty container (or, in Python term's, an empty 'dict'). Yanglint 1.x used to accept #1, kinks are being worked out on the 2.x branch. Kent // contributor > On Mar 29, 2022, at 10:21 AM, Jack Rickard <jack.rickard=40microsoft.com@dmarc.ietf.org> wrote: > > Hi, > > I think I’ve found an ambiguity in RFC 7951, and I’d like your input on what was intended and what the best behaviour to exhibit is. > > Section 5.3 and 5.4 of RFC 7951 - JSON Encoding of Data Modeled with YANG (ietf.org) <https://datatracker.ietf.org/doc/html/rfc7951#section-5.3> describe the encoding of leaf-lists and lists, however it’s unclear how an empty list should be encoded. Should it be encoded as: > An empty array: {“list”: []} > A missing field: {} > > I’ve seen libraries go either way, libyang only accepts 2 but the python yangson library accepts both (I’m not sure which is the default). > > Thanks, > Jack Rickard > he/him > Software Engineer > jack.rickard@microsoft.com <mailto:jack.rickard@microsoft.com> > > <image001.png> > > > _______________________________________________ > netmod mailing list > netmod@ietf.org <mailto:netmod@ietf.org> > https://www.ietf.org/mailman/listinfo/netmod <https://www.ietf.org/mailman/listinfo/netmod>
- [netmod] RFC 7951 - JSON encoding of empty lists Jack Rickard
- Re: [netmod] RFC 7951 - JSON encoding of empty li… Kent Watsen
- Re: [netmod] RFC 7951 - JSON encoding of empty li… Jack Rickard
- Re: [netmod] RFC 7951 - JSON encoding of empty li… Kent Watsen
- Re: [netmod] RFC 7951 - JSON encoding of empty li… Ladislav Lhotka
- Re: [netmod] RFC 7951 - JSON encoding of empty li… Kent Watsen