parser json BUGFIX do not print empty node prefixes
diff --git a/src/parser_json.c b/src/parser_json.c
index 57e1d0e..0d3c09f 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -607,9 +607,15 @@
NULL, LY_VALUE_JSON, NULL, meta->hints);
LY_CHECK_GOTO(ret, cleanup);
} else if (lydctx->parse_opts & LYD_PARSE_STRICT) {
- LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE,
- "Unknown (or not implemented) YANG module \"%s\" for metadata \"%s%s%s\".",
- meta->name.prefix, meta->name.prefix, ly_strlen(meta->name.prefix) ? ":" : "", meta->name.name);
+ if (meta->name.prefix) {
+ LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE,
+ "Unknown (or not implemented) YANG module \"%s\" of metadata \"%s%s%s\".",
+ meta->name.prefix, meta->name.prefix, ly_strlen(meta->name.prefix) ? ":" : "",
+ meta->name.name);
+ } else {
+ LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE, "Missing YANG module of metadata \"%s\".",
+ meta->name.name);
+ }
ret = LY_EVALID;
goto cleanup;
}
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index 39faaa2..87a4400 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -131,7 +131,7 @@
lyd_free_all(tree);
PARSER_CHECK_ERROR(data, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Unknown (or not implemented) YANG module \"x\" for metadata \"x:xxx\".", "Data location /@a:foo, line number 1.");
+ "Unknown (or not implemented) YANG module \"x\" of metadata \"x:xxx\".", "Data location /@a:foo, line number 1.");
/* missing referenced metadata node */
PARSER_CHECK_ERROR("{\"@a:foo\" : { \"a:hint\" : 1 }}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,