v0.4.2
Fixed
@dx.validatesis no longer a silent no-op. The metaclass walkstarget.__mro__for methods carrying the__didactic_validator__marker and stores them on the class as__field_validators__;Model.__init__andModel.with_(...)invoke them in the right order:dx.field(converter=...)first, thenmode="before"validators on the raw value, then the encoder, thenmode="after"validators on the canonical decoded value (re-encoded if the validator returned a different value). Validators mayraise ValueError/raise TypeErrorto reject the input; failures surface asValidationErrorentries withtype="validator_error"andloc=(field_name,). Instance,@classmethod, and@staticmethodshapes all work. Subclasses inherit a parent's validators; a subclass override that re-applies@validatesreplaces the inherited method, and a subclass that shadows the method without@validatesdeliberately disables validation for that field. (#17)
Changed
docs/guide/validators.mdwas rewritten to document theraise ValueError/ return-value-replaces-stored-value contract (the previous draft described areturn boolshape that the runtime never implemented), and to covermode="before", multi-field validators, multiple-validator chaining, inheritance semantics, and the three method shapes.
Full changelog: https://github.com/panproto/didactic/blob/main/CHANGELOG.md