httk.core.schema_check¶
Structural compatibility checks for record dataclasses and entry schemas.
This is a structural compatibility check: it compares property/field names, nullability, and shallow Python type shape. It deliberately does not check units, requirements or sortable flags, dictionary value schemas, nested required keys, enums or patterns, or cross-field constraints. A passing check therefore does not mean that two models are semantically equivalent.
Functions¶
|
Return structural mismatches between a dataclass and an entry definition. |
Module Contents¶
- httk.core.schema_check.check_record_matches_definition(record, definition, *, property_keys=None, internal_fields=(), ignore_properties=('id', 'type'))[source]¶
Return structural mismatches between a dataclass and an entry definition.
property_keysmaps dataclass field names to served property names; it is the inverse ofproperty_keys(), which maps served property names to record keys. An omitted mapping uses identity for every field.internal_fieldsare skipped on the dataclass side, andignore_propertiesare skipped on the definition side. Messages are sorted for stable output.- Parameters:
record (type) – Dataclass whose fields are checked.
definition (httk.core.property_definitions.EntryTypeDefinition) – Entry definition whose properties are checked.
property_keys (collections.abc.Mapping[str, str] | None) – Optional mapping from record field names to served property names.
internal_fields (collections.abc.Collection[str]) – Record fields to exclude from compatibility checks.
ignore_properties (collections.abc.Collection[str]) – Definition properties to exclude from compatibility checks.
- Returns:
Sorted descriptions of structural mismatches, or an empty list when compatible.
- Return type: