You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pydantic: optional automatic models and a project-wide default schema base class #172
Citry already accepts Pydantic v1 and v2 models as component schemas: Kwargs, Slots, State, JsData and Events data can each be a BaseModel. But a plain declaration like
classKwargs:
title: strcount: int=0
is validated by Citry's own rules, and there is no way to say "use Pydantic for every schema in this project", or to give every schema the same Pydantic settings (model_config, for example extra="forbid" or str_strip_whitespace=True) without repeating them on each class.
Proposal
A project-wide setting that turns plain schema declarations into Pydantic models automatically (opt-in).
A setting for the default base class used for schemas, so a project can supply its own BaseModel subclass with shared model_config. Consider whether this belongs on Citry(...) settings and how it applies to extensions that add their own schemas (one rule for all, not per extension).
Decide how a class-level choice overrides the default, and what happens when Pydantic isn't installed (error at startup, not at render).
Related: #129 (form integration from Python classes).
Activity
feat(events): let State be a Pydantic v2 or v1 model
JuroOravec commentedon Oct 28, 2026
Done in #455 (
model_basefor dataclass, Pydantic v1 and v2, and NamedTuple) and #461 (Pydantic State).