baybe.serialization.core.make_base_unstructure_hook

baybe.serialization.core.make_base_unstructure_hook(base: type[_T])[source]

Create a hook for unstructuring subclasses using annotations of their base class.

For generic base classes, the created hook preserves the generic type parameters when unstructuring fields. For example, if a field is annotated as a parameterized generic (e.g., BaseClass[Type]), the field value will be unstructured using that parameterized type rather than just the runtime concrete subclass.