A statically typed data structure validator with support for advance features.
Table of Contents
$ pip install git+https://github.com/zomatree/spec
class MyModel(spec.Model):
a: int
b: str
foo = MyModel({"a": 1, "b": "bar"})
print(foo.a)
print(foo.b)
class Inner(spec.Model):
v: int
class Outer(spec.Model):
inner: Inner
other: str
data = Outer({"inner": {"v": 1}, "other": "foo"})
from typing import Annotated
class MyModel(spec.Model):
my_foo = Annotated[int, spec.rename("myFoo")]
data = MyModel({"myFoo": 1})
spec
is distributed under the terms of the MIT license.