json-schema-validator/test/issue-98.cpp
dhmemi 2659e37831 fix: <nlohmann/json-schema.hpp> -> "nlohmann/json-schema.hpp"
Follow the c++ standard, the compiler will ignore local directories
when it searches files include with angle-brackets.
2022-06-06 10:53:19 +08:00

16 lines
445 B
C++

#include "nlohmann/json-schema.hpp"
int main(void)
{
nlohmann::json nlBase{{"$ref", "#/unknown/keywords"}};
nlohmann::json_schema::json_validator validator;
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;
}