Unverified Commit daabb88e authored by Milo Yip's avatar Milo Yip Committed by GitHub

Merge pull request #1068 from yurikhan/violationDetails

Schema violation details
parents 7641af69 b1e556d7
This diff is collapsed.
......@@ -6,6 +6,7 @@
#include "rapidjson/filereadstream.h"
#include "rapidjson/schema.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h"
using namespace rapidjson;
......@@ -67,6 +68,11 @@ int main(int argc, char *argv[]) {
sb.Clear();
validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
fprintf(stderr, "Invalid document: %s\n", sb.GetString());
// Detailed violation report is available as a JSON value
sb.Clear();
PrettyWriter<StringBuffer> w(sb);
validator.GetError().Accept(w);
fprintf(stderr, "Error report:\n%s\n", sb.GetString());
return EXIT_FAILURE;
}
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment