JsonSchemaChecker is a very basic implementation of json schema.
More...
#include <QJsonSchemaChecker.h>
|
bool | setSchema (const QJsonObject &schema) |
|
QPair< bool, bool > | validate (const QJsonObject &value, bool ignoreRequired=false) |
| Validate a JSON structure. More...
|
|
QJsonObject | getAutoCorrectedConfig (const QJsonObject &value, bool ignoreRequired=false) |
| Auto correct a JSON structure. More...
|
|
const QStringList & | getMessages () const |
|
JsonSchemaChecker is a very basic implementation of json schema.
The json schema definition draft can be found at http://tools.ietf.org/html/draft-zyp-json-schema-03
The following keywords are supported:
- type
- required
- properties
- items
- enum
- minimum
- maximum
- addtionalProperties
- minItems
- maxItems
- minLength
- maxLength
§ getAutoCorrectedConfig()
QJsonObject QJsonSchemaChecker::getAutoCorrectedConfig |
( |
const QJsonObject & |
value, |
|
|
bool |
ignoreRequired = false |
|
) |
| |
Auto correct a JSON structure.
- Parameters
-
value | The JSON value to correct |
ignoreRequired | Ignore the "required" keyword in hyperion schema. Default is false |
- Returns
- The corrected JSON structure
§ getMessages()
const QStringList & QJsonSchemaChecker::getMessages |
( |
| ) |
const |
- Returns
- A list of error messages
§ setSchema()
bool QJsonSchemaChecker::setSchema |
( |
const QJsonObject & |
schema | ) |
|
- Parameters
-
- Returns
- true upon succes
§ validate()
QPair< bool, bool > QJsonSchemaChecker::validate |
( |
const QJsonObject & |
value, |
|
|
bool |
ignoreRequired = false |
|
) |
| |
Validate a JSON structure.
- Parameters
-
value | The JSON value to check |
ignoreRequired | Ignore the "required" keyword in hyperion schema. Default is false |
- Returns
- The first boolean is true when the arguments is valid according to the schema. The second is true when the schema contains no errors
-
TODO: Check the Schema in SetSchema() function and remove the QPair result
The documentation for this class was generated from the following files: