data FEATURE printer for YANG data in JSON format
diff --git a/tools/lint/commands.c b/tools/lint/commands.c
index 0ff821b..3c7cf01 100644
--- a/tools/lint/commands.c
+++ b/tools/lint/commands.c
@@ -647,7 +647,7 @@
} else {
#endif
- lyd_parse_data(ctx, in, 0, opts, 0, &data);
+ lyd_parse_data(ctx, in, 0, opts, LYD_VALIDATE_PRESENT, &data);
#if 0
}
}
@@ -734,12 +734,10 @@
case 'f':
if (!strcmp(optarg, "xml")) {
outformat = LYD_XML;
-#if 0
} else if (!strcmp(optarg, "json")) {
outformat = LYD_JSON;
} else if (!strcmp(optarg, "lyb")) {
outformat = LYD_LYB;
-#endif
} else {
fprintf(stderr, "Unknown output format \"%s\".\n", optarg);
goto cleanup;
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index 2b49ee6..f3e955c 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -229,11 +229,9 @@
} else if (!strcmp(ptr, "xml")) {
informat_s = 0;
informat_d = LYD_XML;
-#if 0
} else if (!strcmp(ptr, "json")) {
informat_s = 0;
informat_d = LYD_JSON;
-#endif
} else {
fprintf(stderr, "yanglint error: input file in an unknown format \"%s\".\n", ptr);
return 0;
@@ -391,11 +389,9 @@
} else if (!strcasecmp(optarg, "xml")) {
outformat_s = 0;
outformat_d = LYD_XML;
-#if 0
} else if (!strcasecmp(optarg, "json")) {
outformat_s = 0;
outformat_d = LYD_JSON;
-#endif
} else {
fprintf(stderr, "yanglint error: unknown output format %s\n", optarg);
help(1);
@@ -971,7 +967,7 @@
fprintf(stderr, "yanglint error: input data file \"%s\".\n", data_item->filename);
goto cleanup;
}
- if (lyd_parse_data(ctx, in, 0, options_parser, 0, &data_item->tree)) {
+ if (lyd_parse_data(ctx, in, 0, options_parser, LYD_VALIDATE_PRESENT, &data_item->tree)) {
fprintf(stderr, "yanglint error: Failed to parse input data file \"%s\".\n", data_item->filename);
ly_in_free(in, 0);
goto cleanup;
@@ -1067,6 +1063,9 @@
}
}
#endif
+ if (!out) {
+ ly_out_new_file(stdout, &out);
+ }
lyd_print_all(out, data_item->tree, outformat_d, LYD_PRINT_FORMAT /* TODO defaults | options_dflt */);
#if 0
if (envelope_s) {