data tree FEATURE handle creating keys in lyd_new_path
They are created using the predicate so the
key should then be ignored.
diff --git a/src/tree_data.c b/src/tree_data.c
index 68ed9bf..db2b836 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1381,7 +1381,15 @@
}
break;
case LYS_LEAF:
- /* make there is some value */
+ if (lysc_is_key(schema)) {
+ /* it must have been already created or some error will occur later */
+ assert(cur_parent);
+ node = lyd_child(cur_parent);
+ assert(node && (node->schema == schema));
+ goto next_iter;
+ }
+
+ /* make sure there is some value */
if (!value) {
value = "";
}
@@ -1417,6 +1425,7 @@
lyd_insert_node(NULL, &parent, node);
}
+next_iter:
/* update remembered nodes */
if (!nparent) {
nparent = node;