parent
c12a27eee1
commit
8125a3e352
@ -239,6 +239,12 @@ public:
|
|||||||
if (!new_schema_loaded) // if no new schema loaded, no need to try again
|
if (!new_schema_loaded) // if no new schema loaded, no need to try again
|
||||||
break;
|
break;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
|
for (const auto &file : files_)
|
||||||
|
if (file.second.unresolved.size() != 0)
|
||||||
|
throw std::invalid_argument("after all files have been parsed, '" +
|
||||||
|
(file.first == "" ? "<root>" : file.first) +
|
||||||
|
"' has still undefined references.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void validate(const json::json_pointer &ptr, const json &instance, json_patch &patch, error_handler &e) const final
|
void validate(const json::json_pointer &ptr, const json &instance, json_patch &patch, error_handler &e) const final
|
||||||
|
|||||||
@ -4,7 +4,12 @@ int main(void)
|
|||||||
{
|
{
|
||||||
nlohmann::json nlBase{{"$ref", "#/unknown/keywords"}};
|
nlohmann::json nlBase{{"$ref", "#/unknown/keywords"}};
|
||||||
nlohmann::json_schema::json_validator validator;
|
nlohmann::json_schema::json_validator validator;
|
||||||
validator.set_root_schema(nlBase); // this line will log the caught exception
|
|
||||||
|
|
||||||
return 0;
|
try {
|
||||||
|
validator.set_root_schema(nlBase); // this line will log the caught exception
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
if (std::string("after all files have been parsed, '<root>' has still undefined references.") == e.what())
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user