| 5 | #include "sonic/sonic.h" |
| 6 | |
| 7 | int main() { |
| 8 | std::string json_schema = R"( |
| 9 | {"obj":1} |
| 10 | )"; |
| 11 | |
| 12 | std::string json = R"( |
| 13 | {"it":1, "obj":{"a":{"b":1}, "b":[1]}} |
| 14 | )"; |
| 15 | |
| 16 | sonic_json::Document doc; |
| 17 | doc.Parse(json_schema); |
| 18 | if (doc.HasParseError()) std::cout << "error\n"; |
| 19 | // doc.Parse(json_schema); |
| 20 | |
| 21 | doc.ParseSchema(json); |
| 22 | if (doc.HasParseError()) { |
| 23 | std::cout << "json: " << json.substr(doc.GetErrorOffset()) << std::endl; |
| 24 | } |
| 25 | std::cout << "schema : " << doc.Dump() << std::endl; |
| 26 | } |
| 27 | // g++ -I../include/ -march=haswell --std=c++11 parse_schema.cpp -o |
| 28 | // parse_schema |
nothing calls this directly
no test coverage detected