validation REFACTOR make node order check optional
So that formats that does not support
ordering (JSON) skip this check.
Fixes #1419
diff --git a/src/validation.c b/src/validation.c
index c484dbc..9930f0c 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -49,7 +49,7 @@
}
int
-lyv_data_context(struct lyd_node *node, int options, struct unres_data *unres)
+lyv_data_context(struct lyd_node *node, int options, int check_node_order, struct unres_data *unres)
{
const struct lys_node *siter = NULL;
struct lys_node *sparent, *op;
@@ -114,8 +114,8 @@
}
/* check elements order in case of RPC's input and output */
- if (!(options & (LYD_OPT_TRUSTED | LYD_OPT_NOTIF_FILTER)) && (options & (LYD_OPT_RPC | LYD_OPT_RPCREPLY))
- && (node->validity & LYD_VAL_MAND) && op) {
+ if (check_node_order && !(options & (LYD_OPT_TRUSTED | LYD_OPT_NOTIF_FILTER)) &&
+ (options & (LYD_OPT_RPC | LYD_OPT_RPCREPLY)) && (node->validity & LYD_VAL_MAND) && op) {
if ((node->prev != node) && node->prev->next) {
/* find schema data parent */
for (sparent = lys_parent(node->schema);