tree data UPDATE allow using llist predicate for state leaf-lists
diff --git a/src/tree_data.h b/src/tree_data.h
index cfed40b..db78a4b 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -1519,7 +1519,8 @@
* Also, if a leaf-list is being created and both a predicate is defined in @p path
* and @p value is set, the predicate is preferred.
*
- * For key-less lists and non-configuration leaf-lists, positional predicates should be used (indices starting from 1).
+ * For key-less lists, positional predicates must be used (indices starting from 1). For non-configuration leaf-lists
+ * either positional predicate can be used or leaf-list predicate, when an instance is always created at the end.
* If no predicate is used for these nodes, they are always created.
*
* @param[in] parent Data parent to add to/modify, can be NULL. Note that in case a first top-level sibling is used,
diff --git a/src/tree_data_new.c b/src/tree_data_new.c
index 4c1a818..1633885 100644
--- a/src/tree_data_new.c
+++ b/src/tree_data_new.c
@@ -1347,13 +1347,14 @@
schema = path[u].node;
if (lysc_is_dup_inst_list(schema)) {
- if (!path[u].predicates) {
+ if (!path[u].predicates ||
+ ((schema->nodetype == LYS_LEAFLIST) && (path[u].predicates[0].type == LY_PATH_PREDTYPE_LEAFLIST))) {
/* creating a new key-less list or state leaf-list instance */
create = 1;
new_count = u;
} else if (path[u].predicates[0].type != LY_PATH_PREDTYPE_POSITION) {
LOG_LOCSET(schema, NULL, NULL, NULL);
- LOGVAL(schema->module->ctx, LYVE_XPATH, "Invalid predicate for %s \"%s\" in path \"%s\".",
+ LOGVAL(schema->module->ctx, LYVE_XPATH, "Invalid predicate for state %s \"%s\" in path \"%s\".",
lys_nodetype2str(schema->nodetype), schema->name, str_path);
LOG_LOCBACK(1, 0, 0, 0);
return LY_EINVAL;