akkudoktoreos.core.pydantic.merge_models

akkudoktoreos.core.pydantic.merge_models(source: BaseModel, update_dict: dict[str, Any]) dict[str, Any]

Merge a Pydantic model instance with an update dictionary.

Values in update_dict (including None) override source values. Nested dictionaries are merged recursively. Lists in update_dict replace source lists entirely.

Parameters:
  • source (BaseModel) – Pydantic model instance serving as the source.

  • update_dict (dict[str, Any]) – Dictionary with updates to apply.

Returns:

Merged dictionary representing combined model data.

Return type:

dict[str, Any]