Re: [netmod] json empty leaf encoding strangeness [Re: WG Last Call for draft-ietf-netmod-yang-json-04 (until 2015-06-29)]

Christian Hopps <chopps@chopps.org> Sat, 18 December 2021 13:35 UTC

Return-Path: <chopps@chopps.org>
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 AB1203A0E71 for <netmod@ietfa.amsl.com>; Sat, 18 Dec 2021 05:35:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=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 S_ccXsjksLFq for <netmod@ietfa.amsl.com>; Sat, 18 Dec 2021 05:35:44 -0800 (PST)
Received: from smtp.chopps.org (smtp.chopps.org [54.88.81.56]) by ietfa.amsl.com (Postfix) with ESMTP id 73A933A0E70 for <netmod@ietf.org>; Sat, 18 Dec 2021 05:35:44 -0800 (PST)
Received: from smtpclient.apple (047-026-251-217.res.spectrum.com [47.26.251.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by smtp.chopps.org (Postfix) with ESMTPSA id 38B347D002; Sat, 18 Dec 2021 13:35:43 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\))
From: Christian Hopps <chopps@chopps.org>
In-Reply-To: <1FE71A45-2B1A-4B46-96FF-A1D781F4C47D@tzi.org>
Date: Sat, 18 Dec 2021 08:35:41 -0500
Cc: Christian Hopps <chopps@chopps.org>, Eliot Lear <lear@lear.ch>, "netmod@ietf.org" <netmod@ietf.org>, Ladislav Lhotka <lhotka@nic.cz>
Content-Transfer-Encoding: quoted-printable
Message-Id: <DE0EA6BB-A3FB-40C9-BBDB-8ED8200E7FEE@chopps.org>
References: <D1A4CEB7.B22F7%kwatsen@juniper.net> <20150624145325.GB38016@elstar.local> <m2lhf27sko.fsf@birdie.labs.nic.cz> <1640D503-A676-4BC5-82E6-E08ED04F7106@chopps.org> <4d8189be-aeea-9ed9-b43f-80580acd2b9a@lear.ch> <1FE71A45-2B1A-4B46-96FF-A1D781F4C47D@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3693.40.0.1.81)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/PNMF5cL3Wa6zd_rwrw0HSsEwPts>
Subject: Re: [netmod] json empty leaf encoding strangeness [Re: WG Last Call for draft-ietf-netmod-yang-json-04 (until 2015-06-29)]
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: Sat, 18 Dec 2021 13:35:50 -0000


> On Dec 18, 2021, at 7:59 AM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On 2021-12-18, at 09:20, Eliot Lear <lear@lear.ch> wrote:
>> 
>> Still it seems like the right thing to do, in order to fall into line with the target language spec.
> 
> But that’s not what YANG was designed for.
> YANG is a data modeling language, which incidentally has a couple of representation formats (YANG-XML, YANG-JSON, YANG-CBOR).
> There is no intention for the YANG generic data model (the set of all data models YANG can express) to cover the generic data model of the representation format.

To be clear, the question I raised is about an encoding of YANG modeled data. In particular the JSON encoding of the YANG empty leaf element.

  https://datatracker.ietf.org/doc/html/rfc7951#section-6.9

the justification for having the very odd encoding was that there was some belief that some programming languages might have trouble with the obvious JSON "null" encoding (which stands for "no value" in JSON -- exactly what we want here). An old email gave a python example to try and illustrate this, except the python example was an incorrect use of python for this case (presence check) and not a problem with the natural JSON encoding for no value items. In fact correctly written python code has no problem at all with the more natural "null" encoding, and results in the correct internal representation in python to boot.

This isn't about the YANG specification in general, or making YANG conform to any particular language. It's just about the a choice in the specification for the encoding of YANG in a particular format (JSON).

Thanks,
Chris.



> 
> While RFC 8791 (and before it RFC 8040) extended YANG to be able to describe data in flight, there is no intention that YANG can be used to describe the entire expressibility of the representation format.  We have Relax-NG, CDDL, and a few other modeling approaches if we need that.

> Grüße, Carsten
>