parsers CHANGE if trusted, do not check top-level mandatory
diff --git a/src/parser_json.c b/src/parser_json.c
index 89a72af..6b80a76 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1278,7 +1278,7 @@
}
/* check for missing top level mandatory nodes */
- if (lyd_check_topmandatory(result, ctx, options)) {
+ if (!(options & LYD_OPT_TRUSTED) && lyd_check_topmandatory(result, ctx, options)) {
goto error;
}
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 9cc48a8..852d888 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -597,7 +597,7 @@
}
/* check for missing top level mandatory nodes */
- if (lyd_check_topmandatory(result, ctx, options)) {
+ if (!(options & LYD_OPT_TRUSTED) && lyd_check_topmandatory(result, ctx, options)) {
goto error;
}