![]()  | 
  
    MySQL 9.5.0
    
   Source Code Documentation 
   | 
 
#include "sql-common/json_schema.h"#include "my_rapidjson_size_t.h"#include <rapidjson/document.h>#include <rapidjson/error/error.h>#include <rapidjson/memorystream.h>#include <rapidjson/reader.h>#include <rapidjson/schema.h>#include <rapidjson/stringbuffer.h>#include <cassert>#include <string>#include <utility>#include "my_alloc.h"#include "my_inttypes.h"#include "my_sys.h"#include "sql-common/json_syntax_check.h"Classes | |
| class | Json_schema_validator_impl | 
| Json_schema_validator_impl is an object that contains a JSON Schema that can be re-used multiple times.  More... | |
| class | Json_schema_validator_impl::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... | |
Functions | |
| static bool | parse_json_schema (const char *json_schema_str, size_t json_schema_length, const JsonSchemaErrorHandler &error_handler, const JsonErrorHandler &depth_handler, rapidjson::Document *schema_document) | 
| parse_json_schema will parse a JSON input into a JSON Schema.  More... | |
| bool | is_valid_json_schema (const char *document_str, size_t document_length, const char *json_schema_str, size_t json_schema_length, const JsonSchemaErrorHandler &error_handler, const JsonErrorHandler &depth_handler, bool *is_valid, Json_schema_validation_report *validation_report) | 
| This function will validate a JSON document against a JSON Schema using the validation provided by rapidjson.  More... | |
| bool is_valid_json_schema | ( | const char * | document_str, | 
| size_t | document_length, | ||
| const char * | json_schema_str, | ||
| size_t | json_schema_length, | ||
| const JsonSchemaErrorHandler & | error_handler, | ||
| const JsonErrorHandler & | depth_handler, | ||
| bool * | is_valid, | ||
| Json_schema_validation_report * | report | ||
| ) | 
This function will validate a JSON document against a JSON Schema using the validation provided by rapidjson.
| document_str | A pointer to the JSON document to be validated. | |
| document_length | The length of the JSON document to be validated. | |
| json_schema_str | A pointer to the JSON Schema. | |
| json_schema_length | The length of the JSON Schema. | |
| 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 | A variable containing the result of the validation. If true, the JSON document is valid according to the given JSON Schema. | 
| [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 | if anything went wrong (like parsing the JSON inputs). my_error has been called with an appropriate error message. | 
| false | if the validation succeeded. The result of the validation can be found in the output variable "is_valid". | 
      
  | 
  static | 
parse_json_schema will parse a JSON input into a JSON Schema.
If the input isn't a valid JSON, or if the JSON is too deeply nested, an error will be returned to the user.
| json_schema_str | A pointer to the JSON Schema input | |
| json_schema_length | The length of the JSON Schema 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] | schema_document | An object where the JSON Schema will be put. This variable MUST be initialized. | 
| true | on error (my_error has been called) | 
| false | on success. The JSON Schema can be found in the output parameter schema_document. |