MCPcopy Create free account
hub / github.com/pboettch/json-schema-validator / main

Function main

example/format.cpp:34–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34int main()
35{
36 json_validator validator(nullptr, uri_format_checker); // create validator
37
38 try {
39 validator.set_root_schema(uri_schema); // insert root-schema
40 } catch (const std::exception &e) {
41 std::cerr << "Validation of schema failed, here is why: " << e.what() << "\n";
42 return EXIT_FAILURE;
43 }
44
45 validator.validate(good_uri);
46
47 try {
48 validator.validate(bad_uri);
49 } catch (const std::exception &e) {
50 std::cerr << "Validation expectedly failed, here is why: " << e.what() << "\n";
51 }
52
53 return EXIT_SUCCESS;
54}

Callers

nothing calls this directly

Calls 3

whatMethod · 0.80
set_root_schemaMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected