Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/berislavlopac/momoa
A library for definition, validation and serialisation of Python objects based on JSONSchema specifications.
https://github.com/berislavlopac/momoa
jsonschema
Last synced: 4 months ago
JSON representation
A library for definition, validation and serialisation of Python objects based on JSONSchema specifications.
- Host: GitHub
- URL: https://github.com/berislavlopac/momoa
- Owner: berislavlopac
- Created: 2022-10-04T16:53:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T08:53:04.000Z (6 months ago)
- Last Synced: 2024-09-26T19:06:37.038Z (4 months ago)
- Topics: jsonschema
- Language: Python
- Homepage: https://momoa.readthedocs.io
- Size: 60.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Momoa
A library for definition, validation and serialisation of models based on JSON Schema specifications.
[![Documentation Status](https://readthedocs.org/projects/momoa/badge/?version=latest)](https://momoa.readthedocs.io/en/latest/?badge=latest)
[![Build Status](https://b11c.semaphoreci.com/badges/momoa/branches/main.svg?style=shields&key=3e80692d-ad00-401e-b445-75303b8f35d0)](https://b11c.semaphoreci.com/projects/momoa)## Basic Usage
```python
from datetime import datetime
from momoa import Schema
from momoa.model import UNDEFINEDschema = Schema.from_uri("file://path/to/schema.json")
PersonModel = schema.modelbirthday = datetime(1969, 11, 23)
person = PersonModel(firstName="Boris", lastName="Harrison", birthday=birthday)assert person.age is UNDEFINED
assert person.birthday is UNDEFINEDperson.age = 53
person.birthday = datetime(1969, 11, 23)assert person.age == 53
assert person.birthday == datetime(1969, 11, 23)
```## Compatibility
For validating schemas Momoa depends on [Statham](https://statham-schema.readthedocs.io), which [supports](https://statham-schema.readthedocs.io/en/latest/compatibility.html) the [JSON Schema Draft 6 specification](https://json-schema.org/specification-links.html#draft-6).