nlib
|
These classes are used to validate JSON and msgpack using JSON Schema. More...
#include "nn/nlib/msgpack/JsonSchema.h"
Classes | |
struct | Detail |
If the validation with JSON Schema has failed, a string representing the location where the validation has failed is written into a member named path. More... | |
Public Types | |
enum | Result { kOk = 0, kInvalidParam, kAlreadyInitialized, kOutOfMemory, kFail, kInvalidSchema, kVersionNotSupported } |
The result of the function executed. More... | |
Public Member Functions | |
Result | Validate (const MpObject &obj, Detail *detail) noexcept |
Validates using JSON Schema. More... | |
Constructor, Destructor, and Initialization | |
constexpr | JsonSchemaValidator () noexcept |
Instantiates the object with default parameters (default constructor). | |
~JsonSchemaValidator () noexcept | |
Destructor. | |
JsonSchemaValidator (JsonSchemaValidator &&rhs) | |
Instantiates the object (move constructor). | |
JsonSchemaValidator & | operator= (JsonSchemaValidator &&rhs) |
Move assignment operator. | |
void | Reset () noexcept |
Resets this object to the state immediately after the default constructor was executed. | |
Result | Init (const nlib_byte_t *schema_bytecode, size_t n) noexcept |
Initializes an object by specifying JSON Schema. More... | |
These classes are used to validate JSON and msgpack using JSON Schema.
Definition at line 32 of file JsonSchema.h.
The result of the function executed.
Enumerator | |
---|---|
kOk | Successfully completed. The validation with JSON Schema was successfully completed. |
kInvalidParam | Invalid argument. |
kAlreadyInitialized | Already initialized. |
kOutOfMemory | Failed to allocate memory. |
kFail | The validation with JSON Schema has failed. |
kInvalidSchema | Invalid JSON Schema. |
kVersionNotSupported | This version of JSON Schema contains byte-code generated with JsonSchemaConverter and is not supported. |
Definition at line 34 of file JsonSchema.h.
|
noexcept |
Initializes an object by specifying JSON Schema.
[in] | schema_bytecode | JSON Schema converted to byte-code with JsonSchemaConverter. |
[in] | n | Size of schema_bytecode. |
kOk | Success. |
kInvalidParam | schema_bytecode is NULL or n is 0. |
kAlreadyInitialized | The object has been already initialized. |
kOutOfMemory | Memory allocation failed. |
kInvalidSchema | Invalid schema. |
kVersionNotSupported | Unsupported format. |
Validates using JSON Schema.
[in] | obj | Data to be validated with JSON Schema. |
[in] | detail | If not NULL, additional information is provided when the validation has failed. |
kOk | The validation has been successfully completed. |
kFail | The validation has failed. |
kOutOfMemory | Memory allocation failed. |
kInvalidSchema | Invalid schema. |
© Nintendo Co., Ltd. All rights reserved.