Json schema Model
Project description
Build python objects using JSON schemas:
>>> import jsonschema_model >>> Model = jsonschema_model.model_factory({ ... "name": "Model", ... "properties": { ... "foo": {"type": "string"}, ... "bar": {"type": "array", "items": { ... "type": "object", ... "name": "Bar", ... "properties": { ... "zaz": {"type": "string"}, ... }, ... }}, ... }}) >>> obj = Model(foo="bar") >>> obj {'foo': 'bar'} >>> obj.bar.add(zaz="qux") {'zaz': 'qux'} >>> obj {'foo': 'bar', 'bar': [{'zaz': 'qux'}]} # You can access via attribute or via dict like interface >>> obj["bar"][0].zaz 'qux'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsonschema-model-1.0.0.tar.gz
(3.4 kB
view hashes)