data tree CHANGE remove implicit presence containers
Seems they cause more problems that they solve.
Consequently, there will be exceptions to RFC
7950 conformance. If a NP container has must
or when that evaluate to false, they will not
be present in the data tree nor for XPath
evaluation.
diff --git a/src/tree_data.c b/src/tree_data.c
index 6a1235c..16436fe 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1656,9 +1656,10 @@
node->flags = LYD_DEFAULT | (lysc_node_when(node->schema) ? LYD_WHEN_TRUE : 0);
lyd_insert_node(parent, first, node);
- /* cannot be a NP container with when */
- assert(!lysc_node_when(iter));
-
+ if (lysc_node_when(iter) && node_when) {
+ /* remember to resolve when */
+ LY_CHECK_RET(ly_set_add(node_when, node, 1, NULL));
+ }
if (diff) {
/* add into diff */
LY_CHECK_RET(lyd_val_diff_add(node, LYD_DIFF_OP_CREATE, diff));