read_yaml_config#
- openstef_core.base_model.read_yaml_config(path: Path, class_type: type[T] | TypeAdapter) 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[TypeVar(T, bound=BaseConfig)],TypeAdapter[TypeVar(U)]]) – The target type (a BaseConfig subclass) or a TypeAdapter.path
class_type
- Returns:
A validated configuration instance (either
TorUdepending on the providedclass_type).- Return type:
Union[TypeVar(T, bound=BaseConfig),TypeVar(U)]