tree data UPDATE require equal anchor and moved node schema
In other cases it is difficult to verify that the move
is allowed.
diff --git a/src/tree_data.c b/src/tree_data.c
index 963f6b7..4f5f97a 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2830,8 +2830,8 @@
LOGERR(LYD_CTX(sibling), LY_EINVAL, "Can be used only for user-ordered nodes.");
return LY_EINVAL;
}
- if (lysc_is_key(sibling->schema)) {
- LOGERR(LYD_CTX(sibling), LY_EINVAL, "Cannot insert before keys.");
+ if (node->schema && sibling->schema && (node->schema != sibling->schema)) {
+ LOGERR(LYD_CTX(sibling), LY_EINVAL, "Cannot insert before a different schema node instance.");
return LY_EINVAL;
}
@@ -2854,8 +2854,8 @@
LOGERR(LYD_CTX(sibling), LY_EINVAL, "Can be used only for user-ordered nodes.");
return LY_EINVAL;
}
- if (sibling->next && lysc_is_key(sibling->next->schema)) {
- LOGERR(LYD_CTX(sibling), LY_EINVAL, "Cannot insert before keys.");
+ if (node->schema && sibling->schema && (node->schema != sibling->schema)) {
+ LOGERR(LYD_CTX(sibling), LY_EINVAL, "Cannot insert after a different schema node instance.");
return LY_EINVAL;
}