![]() |
MySQL 8.0.43
Source Code Documentation
|
Json_schema_validator is an object that contains a JSON Schema that can be re-used multiple times. More...
#include <json_schema.h>
Classes | |
| class | My_remote_schema_document_provider |
| This object acts as a handler/callback for the JSON schema validator and is called whenever a schema reference is encountered in the JSON document. More... | |
Public Member Functions | |
| Json_schema_validator (const rapidjson::Document &schema_document) | |
| Construct the cached JSON Schema with the provided JSON document. More... | |
| bool | is_valid_json_schema (const char *document_str, size_t document_length, const char *function_name, bool *is_valid, Json_schema_validation_report *report) const |
| Validate a JSON input against the cached JSON Schema. More... | |
Private Attributes | |
| My_remote_schema_document_provider | m_remote_document_provider |
| rapidjson::SchemaDocument | m_cached_schema |
Json_schema_validator is an object that contains a JSON Schema that can be re-used multiple times.
This is useful in the cases where we have a JSON Schema that doesn't change (which should be quite often).
| Json_schema_validator::Json_schema_validator | ( | const rapidjson::Document & | schema_document | ) |
Construct the cached JSON Schema with the provided JSON document.
| schema_document | A JSON document that contains the JSON Schema definition |
| bool Json_schema_validator::is_valid_json_schema | ( | const char * | document_str, |
| size_t | document_length, | ||
| const char * | function_name, | ||
| bool * | is_valid, | ||
| Json_schema_validation_report * | report | ||
| ) | const |
Validate a JSON input against the cached JSON Schema.
| document_str | A pointer to the JSON input | |
| document_length | The length of the JSON input | |
| function_name | The function name of the caller (to be used in error reporting) | |
| [out] | is_valid | The result of the validation |
| [out] | report | A structure containing a detailed report from the validation. Is only populated if is_valid is set to "false" Can be nullptr if a detailed report isn't needed. |
| true | on error (my_error has been called) |
| false | on success (validation result can be found in the output parameter is_valid) |
|
private |
|
private |