yanglint FEATURE check nested op parent in oper data
diff --git a/tools/lint/common.c b/tools/lint/common.c
index 4fd0fa1..9f50de2 100644
--- a/tools/lint/common.c
+++ b/tools/lint/common.c
@@ -447,7 +447,9 @@
         struct cmdline_file *rpc_f, struct ly_set *inputs, struct ly_set *xpaths)
 {
     LY_ERR ret = LY_SUCCESS;
-    struct lyd_node *tree = NULL, *envp = NULL, *merged_tree = NULL, *oper_tree = NULL;
+    struct lyd_node *tree = NULL, *envp = NULL, *merged_tree = NULL, *oper_tree = NULL, *node;
+    char *path = NULL;
+    struct ly_set *set = NULL;
 
     /* additional operational datastore */
     if (operational_f && operational_f->in) {
@@ -563,6 +565,31 @@
                 }
                 goto cleanup;
             }
+
+            if ((data_type != LYD_TYPE_DATA_YANG) && oper_tree && !(tree->schema->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF))) {
+                /* find the operation */
+                LYD_TREE_DFS_BEGIN(tree, node) {
+                    if (node->schema->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
+                        break;
+                    }
+                    LYD_TREE_DFS_END(tree, node);
+                }
+
+                /* check operation parent existence */
+                path = lyd_path(lyd_parent(node), LYD_PATH_STD, NULL, 0);
+                if (!path) {
+                    ret = LY_EMEM;
+                    goto cleanup;
+                }
+                if ((ret = lyd_find_xpath(oper_tree, path, &set))) {
+                    goto cleanup;
+                }
+                if (!set->count) {
+                    YLMSG_E("Operation \"%s\" parent \"%s\" not found in the operational data.\n", LYD_NAME(node), path);
+                    ret = LY_EVALID;
+                    goto cleanup;
+                }
+            }
         }
 
         /* next iter */
@@ -597,5 +624,7 @@
     lyd_free_all(envp);
     lyd_free_all(merged_tree);
     lyd_free_all(oper_tree);
+    free(path);
+    ly_set_free(set, NULL);
     return ret;
 }
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index 5ff8a69..3801dfe 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -245,10 +245,11 @@
             "                Write the output to OUTFILE instead of stdout.\n\n");
 
     printf("  -O FILE, --operational=FILE\n"
-            "                Provide optional data to extend validation of the 'rpc',\n"
-            "                'reply' or 'notif' TYPEs. The FILE is supposed to contain\n"
-            "                the :running configuration datastore and state data\n"
-            "                (operational datastore) referenced from the RPC/Notification.\n\n");
+            "                Provide optional data to extend validation of the '(nc-)rpc',\n"
+            "                '(nc-)reply' or '(nc-)notif' TYPEs. The FILE is supposed to contain\n"
+            "                the operational datastore referenced from the operation.\n"
+            "                In case of a nested operation, its parent existence is also\n"
+            "                checked in these operational data.\n\n");
 
     printf("  -R FILE, --reply-rpc=FILE\n"
             "                Provide source RPC for parsing of the 'nc-reply' TYPE. The FILE\n"