Skip to content

Base

logger = logging.getLogger(__name__) module-attribute

SchemaBase

Bases: BaseModel, ABC

Base class for all schemas.

model_config = ConfigDict(extra='forbid') class-attribute instance-attribute

__eq__(other)

Compare by the model_dump so that excluded values are not compared.

equal_to(other, keys_to_recursively_remove=None)

For more complex comparisons where schema1 == schema2 is not sufficient.

Note 2024-05-16: Not easy to compare when some fields are not loaded. Not sure how to handle that yet.


other: The other schema to compare to
keys_to_recursively_remove: List of keys to recursively remove from the comparison before checking equality

set_not_loaded_on_unsaved(values)

Set any values that have a NotSaved annotation and are not present to NotLoaded.