Subject: Re: [netmod] yang-json document
From: Martin Bjorklund <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 05 Feb 2015 13:52:10 +0100 (CET)
List-Id: NETMOD WG list <netmod.ietf.org>

Ladislav Lhotka <[email-masked]> wrote:
> Hi,
> 
> $SUBJ is already several months late, so I think we should proceed
> towards delivering it. I checked my mail archive since the -02 revision,
> and it seems two issues need to be resolved:
> 
> 1. Andy objected to making redundant namespace prefixes illegal. I
>    propose the following change to 4th paragraph in sec. 4 (SHOULD NOT
>    instead of MUST NOT):
> 
>    OLD
> 
>    Names with namespace identifiers in the form shown in Figure 1 MUST
>    be used for all top-level YANG data nodes, and also for all nodes
>    whose parent node belongs to a different namespace.  Otherwise, names
>    with namespace identifiers MUST NOT be used.
> 
>    NEW
> 
>    Names with namespace identifiers in the form shown in Figure 1 MUST
>    be used for all top-level YANG data nodes, and also for all nodes
>    whose parent node belongs to a different namespace.  Otherwise, names
>    with namespace identifiers SHOULD NOT be used.

I don't think this is a good idea.  The reason is that it complicates
both client and server code.  An implementation cannot write code like
this:

   name = interface['name']
   mtu = interface['mtu']

instead we have to look for both 'name' and 'ietf-interfaces:name':

   if 'name' in interface:
     name = interface['name']
   else
     name = interface['ietf-interfaces:name']

One single deterministic encoding is simpler everywhere and less
error-prone.
  
> 2. anyxml encoding: although it is a misnomer, I propose to keep the
>    current definition (sec. 5.5), i.e. allow any valid JSON value in
>    JSON-encoded anyxml instances. I also think the text makes it
>    sufficiently clear that no standard mapping between XML- and
>    JSON-encoded instances is defined.

Ok.

/martin