![]() |
MySQL 9.0.0
Source Code Documentation
|
Json_schema_validator_impl is an object that contains a JSON Schema that can be re-used multiple times. More...
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_impl (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 JsonSchemaErrorHandler &error_handler, const JsonErrorHandler &depth_handler, 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_impl 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_impl::Json_schema_validator_impl | ( | 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_impl::is_valid_json_schema | ( | const char * | document_str, |
size_t | document_length, | ||
const JsonSchemaErrorHandler & | error_handler, | ||
const JsonErrorHandler & | depth_handler, | ||
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 | |
error_handler | Error handlers to be called when parsing errors occur. | |
depth_handler | Pointer to a function that should handle error occurred when depth is exceeded. | |
[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 |