Re: [netmod] yang-json document

Ladislav Lhotka <lhotka@nic.cz> Fri, 06 February 2015 12:49 UTC

Return-Path: <lhotka@nic.cz>
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 A2C921A1A55 for <netmod@ietfa.amsl.com>; Fri, 6 Feb 2015 04:49:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] 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 QeKvYgTZQWoG for <netmod@ietfa.amsl.com>; Fri, 6 Feb 2015 04:49:01 -0800 (PST)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 992AC1A1A17 for <netmod@ietf.org>; Fri, 6 Feb 2015 04:49:01 -0800 (PST)
Received: from localhost (unknown [195.113.220.110]) by trail.lhotka.name (Postfix) with ESMTPSA id C367F1CC0248; Fri, 6 Feb 2015 13:49:00 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Phil Shafer <phil@juniper.net>, Andy Bierman <andy@yumaworks.com>
In-Reply-To: <201502060448.t164mNSX059800@idle.juniper.net>
References: <201502060448.t164mNSX059800@idle.juniper.net>
User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.51.2 (x86_64-apple-darwin14.0.0)
Date: Fri, 06 Feb 2015 13:49:02 +0100
Message-ID: <m2mw4rxl1d.fsf@birdie.labs.nic.cz>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/ZOYOFynCeKLETf4DJQC78FhwPUg>
Cc: "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] yang-json document
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: Fri, 06 Feb 2015 12:49:06 -0000

Phil Shafer <phil@juniper.net> writes:

> Andy Bierman writes:
>>> So how would you encode an arbitrary XML snippet (which is what anyxml
>>> is) in JSON?  I know you want to restrict anyxml, but that is simply
>>> not how it is defined in 6020.  For now we have to live with that.
>>
>>No -- the description-stmts for the anyxml nodes in YANG Patch
>>specify the limitations and an implementation of ietf-yang-patch
>>MUST support what it says.  If other individual YANG modules
>>want to constrain anyxml in specific ways, they can do that.
>>We can specify what an implementation of a particular module MUST
>>accept.
>
> Doesn't this mean that yang-patch is not compatible with
> yang, since one can define models in yang that yang-patch
> will not handle?
>
>>XML has simple nodes which are empty and those which are not empty.
>>  XML non-empty simple node <-->  JSON string
>>  XML empty node <--> JSON null
>>  XML complex node <--> JSON object
>
> This is an extreme oversimplification.  Consider the real-world
> case:
>
>     anyxml web-banner {
>         description "Chunk of XHTML that is placed at the
>                 top of every page for the embedded web server";
>     }
>
>     <web-banner>
>         <p>This is <em>very</em> sensitive data </p>
>         <img src="mister-yuk.png"/>
>         <p>I'm serious, dude</p>
>     </web-banner>
>
> What does the JSON for this look like?  I think the only viable
> answer is:
>
>     "web-banner": "<p>This is <em>very</em> sensitive data </p>\n<img
>     src="mister-yuk.png"/>\n<p>I'm serious, dude</p>\n"

I don't think so, the following is IMO a much better option:

    "web-banner":
      "This is *very sensitive* data.

       ![](mister-yuk.png)

       I'm serious, dude"

To be able to do this, it should be sufficient that the description of
the "web-banner" anyxml node states that HTML has to be used in XML
encoding and markdown in JSON.

Note that the -00 version of the draft contained a very similar example:

http://tools.ietf.org/html/draft-ietf-netmod-yang-json-00#section-3.2.5

Lada

>
> Thanks,
>  Phil
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C