Schema
A schema for parsing and validating structured data.
Usage
Schema()Parameters
definition: dict-
The schema definition.
Examples
>>> s = Schema({"type": "object"})
>>> s.parse({"key": "value"})
{'key': 'value'}Methods
| Name | Description |
|---|---|
| __init__() | Initialize the schema. |
| parse() | Parse data according to the schema. |
__init__()
Initialize the schema.
Usage
__init__(definition)Parameters
definition: dict-
The schema definition.
parse()
Parse data according to the schema.
Usage
parse(data)Parameters
data: dict-
The data to parse.
Returns
dict-
The parsed data.