PLAIN PYTHON · ZERO RUNTIME DEPS
Optional class schemas
Use Schema for attribute access while keeping the released syntax limits visible.
One engine, optional declarations
Subclass Schema with concrete field annotations, then call validate(User, data) to get an instance with attributes. Dict schemas remain a first-class entry point; classes are an optional syntax choice.
from zodify import Schema, validate
class User(Schema):
name: str
age: int
user = validate(User, {"name": "Ada", "age": 36})
assert user.name == "Ada"
assert user.age == 36
print("class-schemas: passed")
Expected output: class-schemas: passed
Use the supported subset
Do not assume arbitrary postponed annotations, forward references, recursive models, general inheritance, generics, or every typing construct are supported. The example uses concrete annotations without 'from __future__ import annotations'.
Validator is reusable validation configuration. In this release it is not a compiled schema cache.