model_kind_validation
Per-category field validation framework using KindPolicy and FieldPolicy rules.
NormalizedModelStyle
module-attribute
FieldPolicy
dataclass
Per-field validation policy for a category.
Source code in src/horde_model_reference/model_kind_validation.py
KindPolicy
dataclass
Collection of field policies for a category.
Source code in src/horde_model_reference/model_kind_validation.py
KindPolicyRegistry
Registry for category-specific validation policies.
Source code in src/horde_model_reference/model_kind_validation.py
__init__
register
Register a KindPolicy for a specific category.
Parameters:
-
category(str) –The model reference category to associate with the policy.
-
policy(KindPolicy) –The KindPolicy instance containing field validation rules.
Raises:
-
ValueError–If a policy is already registered for the given category.
Source code in src/horde_model_reference/model_kind_validation.py
get
Retrieve the KindPolicy for a given category, or None if no policy is registered.
Parameters:
-
category(str) –The model reference category to look up.
Returns:
-
KindPolicy | None–The KindPolicy associated with the category, or None if not found.