Skip to content

Commit 1962c25

Browse files
committed
Use BaseConfigSchema as the default schema in load_config()
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 6902fd7 commit 1962c25

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This release includes a new `ConfigManager` class to simplify managing the confi
3030

3131
* `load_config()`:
3232

33-
+ The `base_schema` argument is now keyword-only.
33+
+ The `base_schema` argument is now keyword-only and defaults to `BaseConfigSchema`.
3434
+ The arguments forwarded to `marshmallow.Schema.load()` now must be passed explicitly via the `marshmallow_load_kwargs` argument, as a `dict`, to improve the type-checking.
3535

3636
* `ConfigManagingActor`: Raise a `ValueError` if the `config_files` argument an empty sequence.

src/frequenz/sdk/config/_util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from marshmallow import Schema
1010
from marshmallow_dataclass import class_schema
1111

12+
from ._base_schema import BaseConfigSchema
13+
1214

1315
# This is a hack that relies on identifying dataclasses by looking into an undocumented
1416
# property of dataclasses[1], so it might break in the future. Nevertheless, it seems to
@@ -33,7 +35,7 @@ def load_config(
3335
config: Mapping[str, Any],
3436
/,
3537
*,
36-
base_schema: type[Schema] | None = None,
38+
base_schema: type[Schema] | None = BaseConfigSchema,
3739
marshmallow_load_kwargs: dict[str, Any] | None = None,
3840
) -> DataclassT:
3941
"""Load a configuration from a dictionary into an instance of a configuration class.

0 commit comments

Comments
 (0)