* Restconf top-level operations GET root resource modified to comply with

RFC 8040 Sec 3.1
  * non-pretty print remove all spaces, eg `{"operations":{"clixon-example:client-rpc":[null]`
  * Replaced JSON `null` with `[null]` as proper empty JSON leaf/leaf-list encoding.
* [Cannot write to config using restconf example #91](https://github.com/clicon/clixon/issues/91)
  * Updated restconf documentation (the example was wrong)
* [clixon-lib yang revision file name update #92](https://github.com/clicon/clixon/issues/92)
  * Clixon-lib yang file had conflicting filename and internal yang revision.
  * This was only detected in the use-case when a whole dir was loaded.
  * Inserted sanity check in all yang parse routines.
  * Committed updated clixon-lib yang file that triggered the error
This commit is contained in:
Olof hagsand 2019-08-24 15:30:43 +02:00
parent a8906fd0bd
commit 6df434093e
12 changed files with 230 additions and 192 deletions

View file

@ -449,7 +449,10 @@ api_operations_get(clicon_handle h,
cprintf(cbx, "<operations>");
break;
case YANG_DATA_JSON:
cprintf(cbx, "{\"operations\": {");
if (pretty)
cprintf(cbx, "{\"operations\": {\n");
else
cprintf(cbx, "{\"operations\":{");
break;
default:
break;
@ -467,14 +470,19 @@ api_operations_get(clicon_handle h,
cprintf(cbx, "<%s xmlns=\"%s\"/>", yang_argument_get(yc), namespace);
break;
case YANG_DATA_JSON:
if (i++)
if (i++){
cprintf(cbx, ",");
cprintf(cbx, "\"%s:%s\": null", yang_argument_get(ymod), yang_argument_get(yc));
if (pretty)
cprintf(cbx, "\n\t");
}
if (pretty)
cprintf(cbx, "\"%s:%s\": [null]", yang_argument_get(ymod), yang_argument_get(yc));
else
cprintf(cbx, "\"%s:%s\":[null]", yang_argument_get(ymod), yang_argument_get(yc));
break;
default:
break;
}
}
}
switch (media_out){
@ -482,7 +490,10 @@ api_operations_get(clicon_handle h,
cprintf(cbx, "</operations>");
break;
case YANG_DATA_JSON:
cprintf(cbx, "}}");
if (pretty)
cprintf(cbx, "}\n}");
else
cprintf(cbx, "}}");
break;
default:
break;