aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/input/json-parsing/json_helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/input-output/input/json-parsing/json_helper.cpp')
-rw-r--r--src/main/input-output/input/json-parsing/json_helper.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/input-output/input/json-parsing/json_helper.cpp b/src/main/input-output/input/json-parsing/json_helper.cpp
index f53da6c..927787c 100644
--- a/src/main/input-output/input/json-parsing/json_helper.cpp
+++ b/src/main/input-output/input/json-parsing/json_helper.cpp
@@ -4,6 +4,7 @@
#include <fstream>
#include <sstream>
+#include <rapidjson/stringbuffer.h>
#include "json_helper.h"
#include "../../output/log_helper.h"
@@ -40,3 +41,18 @@ void json_helper::json_parse_err(const string& msg) {
void json_helper::json_parse_warning(const string& msg) {
LOG_WARNING("Error in JSON doc: " + msg);
}
+
+const string json_helper::schema_err_str(const SchemaValidator& validator) {
+ string ret = "Input JSON failed to match the required schema. Schema Validator Error = ";
+
+ StringBuffer sb;
+ validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
+ ret += validator.GetInvalidSchemaKeyword();
+ ret += ": ";
+
+ sb.Clear();
+ validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
+
+ ret += sb.GetString();
+ return ret;
+}