* Added sorting of YANG statements

* Some openconfig specs seem to have use/when before a "config" which it depends on. This leads to XML encoding being in the "wrong order.
  * When parsing, clixon now sorts container/list statements so that sub-statements with WHEN are put last.
  * See [Statements given in "load set" are order dependent](https://github.com/clicon/clixon/issues/287)
* Fixed: [Statements given in "load set" are order dependent](https://github.com/clicon/clixon/issues/287)
This commit is contained in:
Olof hagsand 2021-11-16 14:28:16 +01:00
parent a64464beda
commit acc9c083a4
11 changed files with 181 additions and 39 deletions

View file

@ -128,3 +128,14 @@
* Consider removing this option after 5.4
*/
#undef JSON_CDATA_STRIP
/*!
* RFC 7950 generally does not specify an XML/JSON encoding order of sub-elements of list or
* containers. See sections 7.5.7 and 7.8.5
* There are some exceptions, eg rpc/action input/output or list key elements
* Clixon by default encodes them in yang order.
* Set this option if you want sub-elements with WHEN sub-statements last
* See https://github.com/clicon/clixon/issues/287
* Consider enabling this option permanently after 5.4
*/
#define YANG_ORDERING_WHEN_LAST