- JSON Schema validator wrapper library
- This library used to validate the json samples against the json schema. For this purpose, we have C++ json schema validator library. To use this library, C applications required a wrapper library with C linkage to use actual C++ validator library.
- Link
libjson_schema_validator_wrapper
in the application. - Include
json_schema_validator_wrapper.h
header in the application.
- int json_validator_init(const char *json_schema_path);
- int json_validator_validate_request(const char *json_string);
- int json_validator_terminate();
int ret;
ret = json_validator_init("/tmp/json_schema.json");
...
ret = json_validator_validate_request(buffer); /* buffer contains json message. */
...
json_validator_terminate();
Its code depends with pboettch/json-schema-validator
and nlohmann/json
library.
https://github.com/pboettch/json-schema-validator
https://github.com/nlohmann/json
- A test application
test_json_schema_validator
provided as part of library. - Run test application:
test_schema_validator <schema.json> <sample.json>