plugins exts UPDATE pass validation flags to ext node clb
diff --git a/src/parser_json.c b/src/parser_json.c
index 79b62a9..82f961b 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1416,8 +1416,10 @@
/* add/correct flags */
LY_CHECK_RET(lyd_parse_set_data_flags(*node, &(*node)->meta, (struct lyd_ctx *)lydctx, ext));
- /* store for ext instance node validation, if needed */
- LY_CHECK_RET(lyd_validate_node_ext(*node, &lydctx->ext_node));
+ if (!(lydctx->parse_opts & LYD_PARSE_ONLY)) {
+ /* store for ext instance node validation, if needed */
+ LY_CHECK_RET(lyd_validate_node_ext(*node, &lydctx->ext_node));
+ }
} else if (ret == LY_ENOT) {
/* parse it again as an opaq node */
ret = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len, parent, status, status, first_p, node);
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index ddfb5c0..0e6bf9c 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -992,8 +992,10 @@
/* insert into parent */
lyb_insert_node(lybctx, parent, *node, first_p, parsed);
- /* store for ext instance node validation, if needed */
- (void)lyd_validate_node_ext(*node, &lybctx->ext_node);
+ if (!(lybctx->parse_opts & LYD_PARSE_ONLY)) {
+ /* store for ext instance node validation, if needed */
+ (void)lyd_validate_node_ext(*node, &lybctx->ext_node);
+ }
*node = NULL;
}
diff --git a/src/parser_xml.c b/src/parser_xml.c
index a321280..49b20fb 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -845,8 +845,10 @@
/* add/correct flags */
LY_CHECK_GOTO(ret = lyd_parse_set_data_flags(node, &meta, (struct lyd_ctx *)lydctx, ext), error);
- /* store for ext instance node validation, if needed */
- LY_CHECK_GOTO(ret = lyd_validate_node_ext(node, &lydctx->ext_node), error);
+ if (!(lydctx->parse_opts & LYD_PARSE_ONLY)) {
+ /* store for ext instance node validation, if needed */
+ LY_CHECK_GOTO(ret = lyd_validate_node_ext(node, &lydctx->ext_node), error);
+ }
}
/* parser next */
diff --git a/src/plugins_exts.h b/src/plugins_exts.h
index 0e521ec..c473158 100644
--- a/src/plugins_exts.h
+++ b/src/plugins_exts.h
@@ -164,14 +164,15 @@
* @brief Callback called for all data nodes connected to the extension instance.
*
* Can be used for additional data node validation. Is called only after the whole data tree is created and standard
- * validation succeeds.
+ * validation succeeds. Not called when parsing data and ::LYD_PARSE_ONLY is used.
*
* @param[in] ext Compiled extension instance.
* @param[in] node Data node to process.
+ * @param[in] validate_options Options used for the validation phase, see @ref datavalidationoptions.
* @return LY_SUCCESS on success.
* @return LY_ERR on error.
*/
-typedef LY_ERR (*lyplg_ext_data_node_clb)(struct lysc_ext_instance *ext, struct lyd_node *node);
+typedef LY_ERR (*lyplg_ext_data_node_clb)(struct lysc_ext_instance *ext, struct lyd_node *node, uint32_t validate_options);
/**
* @brief Callback for getting a schema node for a new YANG instance data described by an extension instance.
diff --git a/src/validation.c b/src/validation.c
index 8353dbf..ad1e5bf 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -296,7 +296,7 @@
struct lyd_ctx_ext_node *ext_n = ext_node->objs[i];
/* validate the node */
- ret = ext_n->ext->def->plugin->node(ext_n->ext, ext_n->node);
+ ret = ext_n->ext->def->plugin->node(ext_n->ext, ext_n->node, val_opts);
LY_CHECK_RET(ret);
/* remove this item from the set */