read_yaml_config#

openstef_core.base_model.read_yaml_config[T: BaseConfig, U](path: Path, class_type: Union[type[T], TypeAdapter[U]]) → Union[T, U][source]#

Read a configuration object from a YAML file.

This function supports two kinds of targets:

  • A subclass of BaseConfig, in which case Pydantic’s model_validate is used.

  • A TypeAdapter instance for more advanced / non-BaseModel schema validation.

Parameters:
  • path (Path) – Path to the YAML file to read.

  • class_type (Union[type[T], TypeAdapter[U]]) – The target type (a BaseConfig subclass) or a TypeAdapter.

Return type:

Union[T, U]

Returns:

A validated configuration instance (either T or U depending on the provided class_type).