We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 384df14 commit a4b62ffCopy full SHA for a4b62ff
example/schemavalidator/schemavalidator.cpp
@@ -6,6 +6,7 @@
6
#include "rapidjson/filereadstream.h"
7
#include "rapidjson/schema.h"
8
#include "rapidjson/stringbuffer.h"
9
+#include "rapidjson/prettywriter.h"
10
11
using namespace rapidjson;
12
@@ -67,6 +68,11 @@ int main(int argc, char *argv[]) {
67
68
sb.Clear();
69
validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
70
fprintf(stderr, "Invalid document: %s\n", sb.GetString());
71
+ // Detailed violation report is available as a JSON value
72
+ sb.Clear();
73
+ PrettyWriter<StringBuffer> w(sb);
74
+ validator.GetError().Accept(w);
75
+ fprintf(stderr, "Error report:\n%s\n", sb.GetString());
76
return EXIT_FAILURE;
77
}
78
0 commit comments