Re: [netmod] attributes in draft-lhotka-netmod-yang-json

Martin Bjorklund <mbj@tail-f.com> Wed, 26 March 2014 14:27 UTC

Return-Path: <mbj@tail-f.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3C5641A00FB for <netmod@ietfa.amsl.com>; Wed, 26 Mar 2014 07:27:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.911
X-Spam-Level:
X-Spam-Status: No, score=-1.911 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
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 uCDxMLGSznZ2 for <netmod@ietfa.amsl.com>; Wed, 26 Mar 2014 07:27:39 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [109.74.15.94]) by ietfa.amsl.com (Postfix) with ESMTP id A6BA21A00E3 for <netmod@ietf.org>; Wed, 26 Mar 2014 07:27:39 -0700 (PDT)
Received: from localhost (138.162.241.83.in-addr.dgcsystems.net [83.241.162.138]) by mail.tail-f.com (Postfix) with ESMTPSA id 8309637C320; Wed, 26 Mar 2014 15:27:37 +0100 (CET)
Date: Wed, 26 Mar 2014 15:27:37 +0100
Message-Id: <20140326.152737.330538996469661145.mbj@tail-f.com>
To: andy@yumaworks.com
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <CABCOCHTg5T+k_LzyNz=bwUKC5AS5gYcBVODL4ZUihUWXQbDbkQ@mail.gmail.com>
References: <20140326.145737.580242632261637255.mbj@tail-f.com> <A169C9A0-970B-4F7B-B102-61543EE553BD@nic.cz> <CABCOCHTg5T+k_LzyNz=bwUKC5AS5gYcBVODL4ZUihUWXQbDbkQ@mail.gmail.com>
X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/kfstj9WgAawWtqRrDlEQhiqsWHY
Cc: netmod@ietf.org
Subject: Re: [netmod] attributes in draft-lhotka-netmod-yang-json
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Wed, 26 Mar 2014 14:27:41 -0000

Andy Bierman <andy@yumaworks.com> wrote:
> On Wed, Mar 26, 2014 at 7:10 AM, Ladislav Lhotka <lhotka@nic.cz> wrote:
> 
> >
> > On 26 Mar 2014, at 14:57, Martin Bjorklund <mbj@tail-f.com> wrote:
> >
> > > Ladislav Lhotka <lhotka@nic.cz> wrote:
> > >> Martin Bjorklund <mbj@tail-f.com> writes:
> > >>
> > >>> Hi,
> > >>>
> > >>> Here's yet another attempt to handle attributes in JSON, without
> > >>> changing the encoding for the case that there are no attributes
> > >>> present.
> > >>>
> > >>> In all examples, the attributes "inactive" and "etag" are present.
> > >>>
> > >>> Attributes are encoded differently depending on the type of object:
> > >>>
> > >>>
> > >>> leaf
> > >>> ----
> > >>>
> > >>> Encode the attributes as a sibling to the leaf.
> > >>>
> > >>>
> > >>>  leaf foo {
> > >>>    type string;
> > >>>  }
> > >>>
> > >>>  "foo": "some value";
> > >>>  "@foo": {
> > >>>     "inactive": true,
> > >>>     "etag": "...";
> > >>>   }
> > >>>
> > >>>
> > >>> list instance
> > >>> -------------
> > >>>
> > >>> Encode the attributes within the list instance.
> > >>>
> > >>>
> > >>>  list bar {
> > >>>    key name;
> > >>>    leaf name {
> > >>>      type string;
> > >>>    }
> > >>>    ...
> > >>>  }
> > >>>
> > >>>  "bar": [
> > >>>     {
> > >>>        "@bar": {
> > >>>           "inactive": true,
> > >>>           "etag": "..."
> > >>>         }
> > >>>         "name": "instance name";
> > >>>      }]
> > >>>
> > >>
> > >> This could be ambiguous:
> > >>
> > >> list bar {
> > >>  key name;
> > >>  leaf name { ... }
> > >>  leaf bar { ... }
> > >> }
> > >>
> > >> Then you don't know whether the attributes belong to the list entry
> > >> or to the contained leaf.
> > >
> > > Right. Then we use "@@bar" for the list / container attributes.
> >
> > OK, then this scheme is fine with me.
> >
> >
> Looks more complicated than other solution proposals.

Do we agree that we don't want different encodings for values if there
are attributes or not?  I.e., if my code works when no attributes are
present, it should also work if there are attributes?

If so, do we have any other proposal?

I am all for a simpler solution!


/martin