24#ifndef SQL_JSON_SCHEMA_H_INCLUDED
25#define SQL_JSON_SCHEMA_H_INCLUDED
60#include <rapidjson/schema.h>
154 const char *function_name,
bool *
is_valid,
165 :
public rapidjson::IRemoteSchemaDocumentProvider {
167 using rapidjson::IRemoteSchemaDocumentProvider::GetRemoteDocument;
208 const char *json_schema_str,
209 size_t json_schema_length,
const char *function_name,
226 size_t json_schema_length,
227 const char *function_name);
Json_schema_validation_report contains a more detailed report about a failed JSON Schema validation.
Definition: json_schema.h:73
const std::string & schema_location() const
Definition: json_schema.h:82
const std::string & document_location() const
Definition: json_schema.h:96
std::string m_schema_location
Definition: json_schema.h:117
std::string human_readable_reason() const
Definition: json_schema.cc:212
const std::string & schema_failed_keyword() const
Definition: json_schema.h:88
std::string m_document_location
Definition: json_schema.h:119
void set_error_report(std::string &&schema_location, const char *schema_failed_keyword, std::string &&document_location)
Populates the object with validation information.
Definition: json_schema.h:108
std::string m_schema_failed_keyword
Definition: json_schema.h:118
This object acts as a handler/callback for the JSON schema validator and is called whenever a schema ...
Definition: json_schema.h:165
bool used() const
Definition: json_schema.h:175
bool m_used
Definition: json_schema.h:178
const rapidjson::SchemaDocument * GetRemoteDocument(const char *, rapidjson::SizeType) override
Definition: json_schema.h:169
Json_schema_validator is an object that contains a JSON Schema that can be re-used multiple times.
Definition: json_schema.h:127
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.
Definition: json_schema.cc:132
Json_schema_validator(const rapidjson::Document &schema_document)
Construct the cached JSON Schema with the provided JSON document.
Definition: json_schema.cc:113
rapidjson::SchemaDocument m_cached_schema
Definition: json_schema.h:182
My_remote_schema_document_provider m_remote_document_provider
Definition: json_schema.h:181
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
bool is_valid_json_schema(const char *document_str, size_t document_length, const char *json_schema_str, size_t json_schema_length, const char *function_name, bool *is_valid, Json_schema_validation_report *report)
This function will validate a JSON document against a JSON Schema using the validation provided by ra...
Definition: json_schema.cc:97
unique_ptr_destroy_only< const Json_schema_validator > create_json_schema_validator(MEM_ROOT *mem_root, const char *json_schema_str, size_t json_schema_length, const char *function_name)
Create a Json_schema_validator, allocated on a given MEM_ROOT.
Definition: json_schema.cc:119
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:477
Define rapidjson::SizeType to be std::uint64_t.
bool is_valid(const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *is_valid) noexcept
Decides if a geometry is valid.
Definition: is_valid.cc:95
typedef::std::uint64_t SizeType
Definition: my_rapidjson_size_t.h:39
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83