63 {
65 if (!mapFilePath.empty()) {
66 std::ifstream mapFile(mapFilePath);
67
68 if (mapFile.is_open()) {
69 VLOG(1) << "MappingFilePath: " << mapFilePath;
70
71 try {
73
74 try {
76
77 try {
79
80 try {
82 } catch (const std::exception& e) {
83 VLOG(1) << e.what();
84 VLOG(1) << "Patching JSON with default patch failed:\n" << defaultPatch.dump(4);
86 }
87 } catch (const std::exception& e) {
88 VLOG(1) <<
" Validating JSON failed:\n" <<
mapFileJsons[mapFilePath].dump(4);
89 VLOG(1) << " " << e.what();
91 }
92 } catch (const std::exception& e) {
93 VLOG(1) << e.what();
94 VLOG(1) <<
"Setting root json mapping schema failed:\n" <<
mappingJsonSchema.dump(4);
96 }
97 } catch (const std::exception& e) {
98 VLOG(1) << "JSON map file parsing failed: " << e.what() << " at " << mapFile.tellg();
100 }
101
102 mapFile.close();
103 } else {
104 VLOG(1) << "MappingFilePath: " << mapFilePath << " not found";
105 }
106 } else {
107 VLOG(1) << "MappingFilePath empty";
108 }
109 }
110
112 }
nlohmann::json_schema::json_validator validator
static nlohmann::json mappingJsonSchema
static std::map< std::string, nlohmann::json > mapFileJsons
json validate(const json &) const