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 , kOutOfMemory, kFail, kInvalidSchema, kVersionNotSupported } |
The result of the function executed. More... | |
Public Member Functions | |
constexpr | JsonSchemaValidator () noexcept |
Instantiates the object with default parameters (default constructor). | |
~JsonSchemaValidator () noexcept | |
Destructor. | |
void | Reset () noexcept |
Sets the object to the same state as the one obtained after the default constructor has run. | |
Result | Init (const nlib_byte_t *schema_bytecode, size_t n) noexcept |
Initializes an object by specifying JSON Schema. More... | |
Result | Validate (const MpObject &obj, Detail *detail) noexcept |
Validates using 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. |
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. |
© 2012-2017 Nintendo Co., Ltd. All rights reserved.