Schema for one JSON object.
More...
#include <parsnip.h>
Schema for one JSON object.
◆ Dependencies
◆ OptionSchemas
◆ Schema() [1/5]
Construct a schema manually.
- Parameters
-
| from | Manually assembled schema components. |
◆ Schema() [2/5]
| Parsnip::Schema::Schema |
( |
| ) |
|
|
default |
◆ Schema() [3/5]
◆ Schema() [4/5]
| Parsnip::Schema::Schema |
( |
Schema && |
| ) |
|
|
default |
◆ Schema() [5/5]
Construct a schema that has been defined in JSON.
- See also
- : http://json-schema.org
- Parameters
-
| schema_spec | The schema specification. |
◆ addMember()
Modify a schema by adding a new dictionary member.
- Parameters
-
| name | The dictionary member to add. |
| new_schema | The schema for the new member. |
| mandatory | If true, the member must be present for dictionaries to be valid. |
| dependencies | The names of other properties that must also be present when this one is. |
◆ dump() [1/2]
| std::ostream & Parsnip::Schema::dump |
( |
const std::string & |
intro, |
|
|
std::ostream & |
target = std::clog |
|
) |
| const |
Dump the schema in human-readable format.
- Parameters
-
| intro | A label for the schema. |
| target | A stream to which to render. |
◆ dump() [2/2]
| std::ostream & Parsnip::Schema::dump |
( |
std::ostream & |
target, |
|
|
int |
indent, |
|
|
bool |
suppress_indent |
|
) |
| const |
|
private |
Dump the schema in human-readable format.
- Parameters
-
| target | A stream to which to render. |
| indent | The amount of indentation to use. |
| suppress_indent | If true, indentation is not done on the first line. |
◆ integrateSchema()
| void Parsnip::Schema::integrateSchema |
( |
const int |
, |
|
|
const class DictionarySchema & |
command |
|
) |
| |
|
private |
Callback function, invoked when generating schemas from an OptionParser.
- Parameters
-
| command | A dataset a valid command would generate. |
◆ operator=()
◆ removeMember()
| void Parsnip::Schema::removeMember |
( |
const char * |
name | ) |
|
Modify a schema by removing a dictionary member.
- Parameters
-
| name | The dictionary member to remove. |
◆ replaceMember()
| void Parsnip::Schema::replaceMember |
( |
const char * |
name, |
|
|
const SchemaBase & |
new_schema |
|
) |
| |
Modify a schema by replacing dictionary member.
Mandatory status and dependencies are unchanged.
- Parameters
-
| name | The dictionary member to replace. |
| new_schema | The replacement schema. |
◆ validate()
| void Parsnip::Schema::validate |
( |
const Data & |
data | ) |
const |
Validate data against the schema.
- Parameters
-
| data | The data to be validated. ` |
- Exceptions
-
| Exceptions | representing the manner of data non-conformance. |
◆ OptionSchema
◆ NoDependencies
◆ schema
The documentation for this class was generated from the following files: