data tree FEATURE lyd_new_path() and lyd_change_term()

With tests included. Also, another missing API
function lyd_new_opaq() added.
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 73849b8..bb70f31 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -6862,8 +6862,9 @@
     assert(node->nodetype & (LYS_LEAF | LYS_LEAFLIST));
 
     /* try to find the target */
-    LY_CHECK_RET(ly_path_compile(node->module, node, lref->path, LY_PATH_LREF_TRUE, lys_resolve_prefix, lref->path_context,
-                                 LYD_SCHEMA, &p));
+    LY_CHECK_RET(ly_path_compile(ctx->ctx, node->module, node, lref->path, LY_PATH_LREF_TRUE,
+                                 lysc_is_output(node) ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_MANY,
+                                 lys_resolve_prefix, lref->path_context, LYD_SCHEMA, &p));
 
     /* get the target node */
     target = p[LY_ARRAY_SIZE(p) - 1].node;