data tree BUGFIX set when_true flag for implciti nodes
So that they are silently removed during validation.
diff --git a/src/tree_data.c b/src/tree_data.c
index b40bdbb..e526e38 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1405,7 +1405,7 @@
if (!(iter->flags & LYS_PRESENCE) && lyd_find_sibling_val(*first, iter, NULL, 0, NULL)) {
/* create default NP container */
LY_CHECK_RET(lyd_create_inner(iter, &node));
- node->flags = LYD_DEFAULT;
+ node->flags = LYD_DEFAULT | (node->schema->when ? LYD_WHEN_TRUE : 0);
lyd_insert_node(parent, first, node);
/* cannot be a NP container with when */
@@ -1429,7 +1429,7 @@
} else if (ret) {
return ret;
}
- node->flags = LYD_DEFAULT;
+ node->flags = LYD_DEFAULT | (node->schema->when ? LYD_WHEN_TRUE : 0);
lyd_insert_node(parent, first, node);
if (iter->when && node_when) {
@@ -1457,7 +1457,7 @@
} else if (ret) {
return ret;
}
- node->flags = LYD_DEFAULT;
+ node->flags = LYD_DEFAULT | (node->schema->when ? LYD_WHEN_TRUE : 0);
lyd_insert_node(parent, first, node);
if (iter->when && node_when) {