Empty values in JSON has changed to comply to RFC 7951

* empty values of yang type `empty` are encoded as: `{"x":[null]}`
   * empty string values are encoded as: `{"x":""}` (changed from `null` in 4.0 and `[null]` in 4.3)
   * empty containers are encoded as: `{"x":{}}`
   * empty elements in unknown/anydata/anyxml encoded as: `{"x":{}}` (changed from `{"x":null}`)
This commit is contained in:
Olof hagsand 2020-03-07 17:15:59 +01:00
parent fdfeec96ec
commit 3febc00a71
7 changed files with 113 additions and 31 deletions

View file

@ -136,6 +136,9 @@ xml_parse_whitespace(clixon_xml_yacc *xy,
xy->xy_xelement = NULL; /* init */
/* If there is an element already, only add one whitespace child
* otherwise, keep all whitespace. See code in xml_parse_bslash
* Note that this xml element is not aware of YANG yet.
* For example, if xp is LEAF then a body child is OK, but if xp is CONTAINER
* then the whitespace body is pretty-prints and should be stripped (later)
*/
for (i=0; i<xml_child_nr(xp); i++){
if (xml_type(xml_child_i(xp, i)) == CX_ELMNT)
@ -397,7 +400,7 @@ endtag : BSLASH NAME '>'
;
elist : elist content { clicon_debug(2, "elist -> elist content"); }
| content { clicon_debug(2, "elist -> content"); }
| content { clicon_debug(2, "elist -> content"); }
;
/* Rule 43 */