GenericSchemaValidator
Engine/source/persistence/rapidjson/schema.h
JSON Schema Validator.
Public Types
EncodingType::Ch
Ch
SchemaType::EncodingType
EncodingType
SchemaDocumentType::PointerType
PointerType
SchemaDocumentType::SchemaType
SchemaType
StringRefType
SchemaType::SValue
SValue
GenericValue< EncodingType, StateAllocator >
ValueType
Private Types
SchemaType::Context
Context
GenericValue< UTF8<>, StateAllocator >
HashCodeArray
internal::Hasher< EncodingType, StateAllocator >
HasherType
Private Static Attributes
const size_t
Private Attributes
internal::Stack< StateAllocator >
stack to store the current path of validating document (Ch)
OutputHandler *
StateAllocator *
const SchemaDocumentType *
internal::Stack< StateAllocator >
stack to store the current path of schema (BaseSchemaType *)
StateAllocator *
bool
Public Functions
GenericSchemaValidator(const SchemaDocumentType & schemaDocument, OutputHandler & outputHandler, StateAllocator * allocator, size_t schemaStackCapacity, size_t documentStackCapacity)
Constructor with output handler.
GenericSchemaValidator(const SchemaDocumentType & schemaDocument, StateAllocator * allocator, size_t schemaStackCapacity, size_t documentStackCapacity)
Constructor without output handler.
Destructor.
AboveMaximum(double actual, const SValue & expected, bool exclusive)
AboveMaximum(int64_t actual, const SValue & expected, bool exclusive)
AboveMaximum(uint64_t actual, const SValue & expected, bool exclusive)
AddDependencySchemaError(const SValue & sourceName, ISchemaValidator * subvalidator)
AddExpectedType(const typename SchemaType::ValueType & expectedType)
AddMissingDependentProperty(const SValue & targetName)
AddMissingProperty(const SValue & name)
BelowMinimum(double actual, const SValue & expected, bool exclusive)
BelowMinimum(int64_t actual, const SValue & expected, bool exclusive)
BelowMinimum(uint64_t actual, const SValue & expected, bool exclusive)
bool
Bool(bool b)
void *
ISchemaValidator *
CreateSchemaValidator(const SchemaType & root)
DestroryHasher(void * hasher)
DestroySchemaValidator(ISchemaValidator * validator)
DisallowedItem(SizeType index)
DisallowedProperty(const Ch * name, SizeType length)
DoesNotMatch(const Ch * str, SizeType length)
bool
Double(double d)
DuplicateItems(SizeType index1, SizeType index2)
bool
EndDisallowedType(const typename SchemaType::ValueType & actualType)
EndMissingDependentProperties(const SValue & sourceName)
bool
GetHashCode(void * hasher)
Gets the JSON pointer pointed to the invalid value.
Gets the keyword of invalid schema.
Gets the JSON pointer pointed to the invalid schema.
bool
Int(int i)
bool
IsValid()
Checks whether the current state is valid.
void *
MallocState(size_t size)
NotMultipleOf(double actual, const SValue & expected)
NotMultipleOf(int64_t actual, const SValue & expected)
NotMultipleOf(uint64_t actual, const SValue & expected)
bool
Null()
PropertyViolations(ISchemaValidator ** subvalidators, SizeType count)
bool
bool
TooFewItems(SizeType actualCount, SizeType expectedCount)
TooFewProperties(SizeType actualCount, SizeType expectedCount)
TooManyItems(SizeType actualCount, SizeType expectedCount)
TooManyProperties(SizeType actualCount, SizeType expectedCount)
bool
Uint(unsigned u)
Private Functions
GenericSchemaValidator(const SchemaDocumentType & schemaDocument, const SchemaType & root, const char * basePath, size_t basePathSize, StateAllocator * allocator, size_t schemaStackCapacity, size_t documentStackCapacity)
AddCurrentError(const typename SchemaType::ValueType & keyword, bool parent)
AddErrorArray(const typename SchemaType::ValueType & keyword, ISchemaValidator ** subvalidators, SizeType count)
AddErrorLocation(ValueType & result, bool parent)
AppendToken(const Ch * str, SizeType len)
bool
Context &
const Context &
bool
EndValue()
StateAllocator &
MergeError(ValueType & other)
RAPIDJSON_FORCEINLINE void
PushSchema(const SchemaType & schema)
Detailed Description
JSON Schema Validator.
A SAX style JSON schema validator. It uses a
GenericSchemaDocumentto validate SAX events. It delegates the incoming SAX events to an output handler. The default output handler does nothing. It can be reused multiple times by calling
Reset().
Parameters:
SchemaDocumentType | Type of schema document. |
OutputHandler | Type of output handler. Default handler does nothing. |
StateAllocator | Allocator for storing the internal validation states. |
Public Types
typedef EncodingType::Ch Ch
typedef SchemaType::EncodingType EncodingType
typedef SchemaDocumentType::PointerType PointerType
typedef SchemaDocumentType::SchemaType SchemaType
typedef GenericStringRef< Ch > StringRefType
typedef SchemaType::SValue SValue
typedef GenericValue< EncodingType, StateAllocator > ValueType
Private Types
typedef SchemaType::Context Context
typedef GenericValue< UTF8<>, StateAllocator > HashCodeArray
typedef internal::Hasher< EncodingType, StateAllocator > HasherType
Private Static Attributes
const size_t kDefaultDocumentStackCapacity
const size_t kDefaultSchemaStackCapacity
Private Attributes
ValueType currentError_
internal::Stack< StateAllocator > documentStack_
stack to store the current path of validating document (Ch)
ValueType error_
ValueType missingDependents_
OutputHandler * outputHandler_
StateAllocator * ownStateAllocator_
const SchemaType & root_
const SchemaDocumentType * schemaDocument_
internal::Stack< StateAllocator > schemaStack_
stack to store the current path of schema (BaseSchemaType *)
StateAllocator * stateAllocator_
bool valid_
Public Functions
GenericSchemaValidator(const SchemaDocumentType & schemaDocument, OutputHandler & outputHandler, StateAllocator * allocator, size_t schemaStackCapacity, size_t documentStackCapacity)
Constructor with output handler.
Parameters:
schemaDocument | The schema document to conform to. |
allocator | Optional allocator for storing internal validation states. |
schemaStackCapacity | Optional initial capacity of schema path stack. |
documentStackCapacity | Optional initial capacity of document path stack. |
GenericSchemaValidator(const SchemaDocumentType & schemaDocument, StateAllocator * allocator, size_t schemaStackCapacity, size_t documentStackCapacity)
Constructor without output handler.
Parameters:
schemaDocument | The schema document to conform to. |
allocator | Optional allocator for storing internal validation states. |
schemaStackCapacity | Optional initial capacity of schema path stack. |
documentStackCapacity | Optional initial capacity of document path stack. |
~GenericSchemaValidator()
Destructor.
AboveMaximum(double actual, const SValue & expected, bool exclusive)
Reimplemented from: internal::IValidationErrorHandler
AboveMaximum(int64_t actual, const SValue & expected, bool exclusive)
Reimplemented from: internal::IValidationErrorHandler
AboveMaximum(uint64_t actual, const SValue & expected, bool exclusive)
Reimplemented from: internal::IValidationErrorHandler
AddDependencySchemaError(const SValue & sourceName, ISchemaValidator * subvalidator)
AddExpectedType(const typename SchemaType::ValueType & expectedType)
Reimplemented from: internal::IValidationErrorHandler
AddMissingDependentProperty(const SValue & targetName)
Reimplemented from: internal::IValidationErrorHandler
AddMissingProperty(const SValue & name)
Reimplemented from: internal::IValidationErrorHandler
BelowMinimum(double actual, const SValue & expected, bool exclusive)
Reimplemented from: internal::IValidationErrorHandler
BelowMinimum(int64_t actual, const SValue & expected, bool exclusive)
Reimplemented from: internal::IValidationErrorHandler
BelowMinimum(uint64_t actual, const SValue & expected, bool exclusive)
Reimplemented from: internal::IValidationErrorHandler
Bool(bool b)
CreateHasher()
Reimplemented from: internal::ISchemaStateFactory
CreateSchemaValidator(const SchemaType & root)
Reimplemented from: internal::ISchemaStateFactory
DestroryHasher(void * hasher)
Reimplemented from: internal::ISchemaStateFactory
DestroySchemaValidator(ISchemaValidator * validator)
Disallowed()
Reimplemented from: internal::IValidationErrorHandler
DisallowedItem(SizeType index)
Reimplemented from: internal::IValidationErrorHandler
DisallowedProperty(const Ch * name, SizeType length)
DisallowedValue()
Reimplemented from: internal::IValidationErrorHandler
DoesNotMatch(const Ch * str, SizeType length)
Double(double d)
DuplicateItems(SizeType index1, SizeType index2)
Reimplemented from: internal::IValidationErrorHandler
EndArray(SizeType elementCount)
EndDependencyErrors()
Reimplemented from: internal::IValidationErrorHandler
EndDisallowedType(const typename SchemaType::ValueType & actualType)
Reimplemented from: internal::IValidationErrorHandler
EndMissingDependentProperties(const SValue & sourceName)
Reimplemented from: internal::IValidationErrorHandler
EndMissingProperties()
Reimplemented from: internal::IValidationErrorHandler
EndObject(SizeType memberCount)
FreeState(void * p)
Reimplemented from: internal::ISchemaStateFactory
GetError()
Gets the error object.
GetError()
GetHashCode(void * hasher)
Reimplemented from: internal::ISchemaStateFactory
GetInvalidDocumentPointer()
Gets the JSON pointer pointed to the invalid value.
GetInvalidSchemaKeyword()
Gets the keyword of invalid schema.
GetInvalidSchemaPointer()
Gets the JSON pointer pointed to the invalid schema.
Int(int i)
Int64(int64_t i)
IsValid()
Reimplemented from: internal::ISchemaValidator
Key(const Ch * str, SizeType len, bool copy)
MallocState(size_t size)
Reimplemented from: internal::ISchemaStateFactory
NoneOf(ISchemaValidator ** subvalidators, SizeType count)
NotAllOf(ISchemaValidator ** subvalidators, SizeType count)
NotMultipleOf(double actual, const SValue & expected)
Reimplemented from: internal::IValidationErrorHandler
NotMultipleOf(int64_t actual, const SValue & expected)
Reimplemented from: internal::IValidationErrorHandler
NotMultipleOf(uint64_t actual, const SValue & expected)
Reimplemented from: internal::IValidationErrorHandler
NotOneOf(ISchemaValidator ** subvalidators, SizeType count)
Null()
PropertyViolations(ISchemaValidator ** subvalidators, SizeType count)
RawNumber(const Ch * str, SizeType length, bool copy)
Reset()
Reset the internal states.
StartArray()
StartDependencyErrors()
Reimplemented from: internal::IValidationErrorHandler
StartDisallowedType()
Reimplemented from: internal::IValidationErrorHandler
StartMissingDependentProperties()
Reimplemented from: internal::IValidationErrorHandler
StartMissingProperties()
Reimplemented from: internal::IValidationErrorHandler
StartObject()
String(const Ch * str, SizeType length, bool copy)
TooFewItems(SizeType actualCount, SizeType expectedCount)
Reimplemented from: internal::IValidationErrorHandler
TooFewProperties(SizeType actualCount, SizeType expectedCount)
Reimplemented from: internal::IValidationErrorHandler
TooLong(const Ch * str, SizeType length, SizeType expected)
TooManyItems(SizeType actualCount, SizeType expectedCount)
Reimplemented from: internal::IValidationErrorHandler
TooManyProperties(SizeType actualCount, SizeType expectedCount)
Reimplemented from: internal::IValidationErrorHandler
TooShort(const Ch * str, SizeType length, SizeType expected)
Uint(unsigned u)
Uint64(uint64_t u)
Private Functions
GenericSchemaValidator(const SchemaDocumentType & schemaDocument, const SchemaType & root, const char * basePath, size_t basePathSize, StateAllocator * allocator, size_t schemaStackCapacity, size_t documentStackCapacity)
AddCurrentError(const typename SchemaType::ValueType & keyword, bool parent)
AddError(ValueType & keyword, ValueType & error)
AddErrorArray(const typename SchemaType::ValueType & keyword, ISchemaValidator ** subvalidators, SizeType count)
AddErrorLocation(ValueType & result, bool parent)
AddNumberError(const typename SchemaType::ValueType & keyword, ValueType & actual, const SValue & expected, const typename SchemaType::ValueType &(*)() exclusive)
AppendToken(const Ch * str, SizeType len)
BeginValue()
CurrentContext()
CurrentContext()
CurrentSchema()
EndValue()
GetStateAllocator()
MergeError(ValueType & other)
PopSchema()
PushSchema(const SchemaType & schema)