Skip to content

A library for definition, validation and serialisation of Python objects based on JSONSchema specifications.

Notifications You must be signed in to change notification settings

berislavlopac/momoa

Repository files navigation

Momoa

A library for definition, validation and serialisation of models based on JSON Schema specifications.

Documentation Status Build Status

Basic Usage

from datetime import datetime
from momoa import Schema
from momoa.model import UNDEFINED

schema = Schema.from_uri("file://path/to/schema.json")
PersonModel = schema.model

birthday = datetime(1969, 11, 23)
person = PersonModel(firstName="Boris", lastName="Harrison", birthday=birthday)

assert person.age is UNDEFINED
assert person.birthday is UNDEFINED

person.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, which supports the JSON Schema Draft 6 specification.

About

A library for definition, validation and serialisation of Python objects based on JSONSchema specifications.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published