es_sfgtools.utils.model_update module

es_sfgtools.utils.model_update.validate_and_merge_config(base_class: BaseModel, override_config: BaseModel | Dict[str, Any]) BaseModel

Validates and merges override configuration with base config, checking for typos.

Parameters:
  • base_class (BaseModel) – The base configuration class instance (Pydantic model).

  • override_config (dict) – The override configuration dictionary to update the base config.

Returns:

A new instance of the base_class with merged configuration.

Return type:

BaseModel

Raises:

ValueError – If there are typos or invalid keys in the override_config.

es_sfgtools.utils.model_update.validate_keys_recursively(config_dict: dict, model_class: BaseModel, path: str = '')

Recursively validate keys and suggest corrections for typos.

Parameters:
  • config_dict (dict) – The dictionary to validate.

  • model_class (BaseModel) – The Pydantic model to validate against.

  • path (str, optional) – The current path in the nested dictionary, for error reporting.

Returns:

A list of error messages.

Return type:

list