7#include <nlohmann/json-schema.hpp>
10using nlohmann::json_schema::json_validator;
15 "$schema": "http://json-schema.org/draft-07/schema#",
19 "description": "Name",
23 "description": "Age of the person",
46 json_validator validator;
50 }
catch (
const std::exception &e) {
51 std::cerr <<
"Validation of schema failed, here is why: " << e.what() <<
"\n";
58 std::cout <<
"About to validate this person:\n"
59 << std::setw(2) << person << std::endl;
61 validator.validate(person);
62 std::cout <<
"Validation succeeded\n";
63 }
catch (
const std::exception &e) {
64 std::cerr <<
"Validation failed, here is why: " << e.what() <<
"\n";
static json person_schema