parser FEATURE parsing validated data with true when
diff --git a/src/parser_common.c b/src/parser_common.c
index a5daeb7..cd32300 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -247,6 +247,10 @@
     struct lyd_ctx_ext_val *ext_val;
 
     if (lysc_has_when(node->schema)) {
+        if (lydctx->parse_opts & LYD_PARSE_WHEN_TRUE) {
+            /* the condition was true before */
+            node->flags |= LYD_WHEN_TRUE;
+        }
         if (!(lydctx->parse_opts & LYD_PARSE_ONLY)) {
             /* remember we need to evaluate this node's when */
             LY_CHECK_RET(ly_set_add(&lydctx->node_when, node, 1, NULL));
diff --git a/src/parser_data.h b/src/parser_data.h
index f7886ab..773947f 100644
--- a/src/parser_data.h
+++ b/src/parser_data.h
@@ -159,6 +159,9 @@
 #define LYD_PARSE_SUBTREE 0x400000          /**< Parse only the current data subtree with any descendants, no siblings.
                                                  Also, a new return value ::LY_ENOT is returned if there is a sibling
                                                  subtree following in the input data. */
+#define LYD_PARSE_WHEN_TRUE 0x800000        /**< Mark all the parsed nodes dependend on a when condition with the flag
+                                                 that means the condition was satisifed before. This allows for
+                                                 auto-deletion of these nodes during validation. */
 
 #define LYD_PARSE_OPTS_MASK 0xFFFF0000      /**< Mask for all the LYD_PARSE_ options. */