Tutorial¶
This tutorial is a single thread that builds a small application end-to-end. The five chapters cover:
- First model: defining a class, instantiating it, and reading its fields.
- Fields and types: defaults, descriptions, the
dx.field(...)metadata constructor, and the built-in scalar types. - Validation: per-field validators, class-level
axioms, and the shape of a
ValidationError. - Serialisation:
model_dump,model_dump_json, the inversemodel_validateandmodel_validate_jsonpaths, plus JSON Schema export. - Writing a migration: defining a
Lensbetween two versions of a Model and registering it for use bydx.migrate.
By the end you will have a working set of Models, a registered migration, a JSON Schema artefact, and a feel for the day-to-day operations didactic supports.
The tutorial assumes Python 3.14 and pip install didactic.