Fixed: ["autocli:hide-show" extension cause bug in xmldb_put method #343](https://github.com/clicon/clixon/issues/343)
As a side-effect, added extra "autocliext" parameter to: - clixon_xml2file() - clixon_json2file() - clixon_json2cbuf() - clixon_txt2file()
This commit is contained in:
parent
e724dd7f40
commit
4514f2a538
26 changed files with 213 additions and 144 deletions
|
|
@ -295,14 +295,14 @@ api_return_err(clicon_handle h,
|
|||
clicon_debug(1, "%s code:%d", __FUNCTION__, code);
|
||||
if (pretty){
|
||||
cprintf(cb, "{\n\"ietf-restconf:errors\" : ");
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "\n}\r\n");
|
||||
}
|
||||
else{
|
||||
cprintf(cb, "{");
|
||||
cprintf(cb, "\"ietf-restconf:errors\":");
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "}\r\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ api_data_get2(clicon_handle h,
|
|||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
if (clixon_json2cbuf(cbx, xret, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cbx, xret, pretty, 0, 0) < 0)
|
||||
goto done;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ yang_patch_xml2json_modified_cbuf(cxobj *x_simple_patch)
|
|||
if (json_simple_patch == NULL)
|
||||
return NULL;
|
||||
cb = cbuf_new();
|
||||
if (clixon_json2cbuf(cb, x_simple_patch, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, x_simple_patch, 0, 0) < 0)
|
||||
goto done;
|
||||
|
||||
// Insert a '[' after the first '{' to get the JSON to match what api_data_post/write() expect
|
||||
|
|
@ -267,7 +267,7 @@ yang_patch_do_replace(clicon_handle h,
|
|||
}
|
||||
}
|
||||
// Convert the data to json
|
||||
if (clixon_json2cbuf(json_simple_patch, x_simple_patch, 0) < 0)
|
||||
if (clixon_json2cbuf(json_simple_patch, x_simple_patch, 0, 0) < 0)
|
||||
goto done;
|
||||
|
||||
// Send the POST request
|
||||
|
|
@ -329,7 +329,7 @@ yang_patch_do_create(clicon_handle h,
|
|||
xml_addsub(x_simple_patch, value_vec_tmp);
|
||||
}
|
||||
}
|
||||
if (clixon_json2cbuf(cb, x_simple_patch, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, x_simple_patch, 0, 0) < 0)
|
||||
goto done;
|
||||
if (api_data_post(h, req, cbuf_get(simple_patch_request_uri),
|
||||
pi, qvec,
|
||||
|
|
@ -479,7 +479,7 @@ yang_patch_do_merge(clicon_handle h,
|
|||
xml_addsub(x_simple_patch, value_vec_tmp);
|
||||
}
|
||||
cbuf_reset(cb); /* reuse cb */
|
||||
if (clixon_json2cbuf(cb, x_simple_patch, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, x_simple_patch, 0, 0) < 0)
|
||||
goto done;
|
||||
|
||||
if ((json_simple_patch = yang_patch_xml2json_modified_cbuf(x_simple_patch)) == NULL)
|
||||
|
|
|
|||
|
|
@ -879,7 +879,7 @@ api_operations_post(clicon_handle h,
|
|||
/* xoutput should now look: <output xmlns="uri"><x>0</x></output> */
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
if (clixon_json2cbuf(cbret, xoutput, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cbret, xoutput, pretty, 0, 0) < 0)
|
||||
goto done;
|
||||
/* xoutput should now look: {"example:output": {"x":0,"y":42}} */
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ api_root_restconf_exact(clicon_handle h,
|
|||
break;
|
||||
case YANG_DATA_JSON:
|
||||
case YANG_PATCH_JSON:
|
||||
if (clixon_json2cbuf(cb, xt, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, xt, pretty, 0, 0) < 0)
|
||||
goto done;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -293,7 +293,7 @@ api_yang_library_version(clicon_handle h,
|
|||
break;
|
||||
case YANG_DATA_JSON:
|
||||
case YANG_PATCH_JSON:
|
||||
if (clixon_json2cbuf(cb, xt, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, xt, pretty, 0, 0) < 0)
|
||||
goto done;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue