65 if (!mapFilePath.empty()) {
66 std::ifstream mapFile(mapFilePath);
68 if (mapFile.is_open()) {
69 VLOG(1) <<
"MappingFilePath: " << mapFilePath;
72 mapFile >> mapFileJsons[mapFilePath];
78 const nlohmann::json defaultPatch = validator.validate(mapFileJsons[mapFilePath]);
81 mapFileJsons[mapFilePath] = mapFileJsons[mapFilePath].patch(defaultPatch);
82 }
catch (
const std::exception& e) {
84 VLOG(1) <<
"Patching JSON with default patch failed:\n" << defaultPatch.dump(4);
85 mapFileJsons[mapFilePath].clear();
87 }
catch (
const std::exception& e) {
88 VLOG(1) <<
" Validating JSON failed:\n" << mapFileJsons[mapFilePath].dump(4);
89 VLOG(1) <<
" " << e.what();
90 mapFileJsons[mapFilePath].clear();
92 }
catch (
const std::exception& e) {
94 VLOG(1) <<
"Setting root json mapping schema failed:\n" <<
mappingJsonSchema.dump(4);
95 mapFileJsons[mapFilePath].clear();
97 }
catch (
const std::exception& e) {
98 VLOG(1) <<
"JSON map file parsing failed: " << e.what() <<
" at " << mapFile.tellg();
99 mapFileJsons[mapFilePath].clear();
104 VLOG(1) <<
"MappingFilePath: " << mapFilePath <<
" not found";
107 VLOG(1) <<
"MappingFilePath empty";
111 return mapFileJsons[mapFilePath];