Skip to content

Commit b03ffd7

Browse files
committed
Validate unknown=INCLUDE is not used in load_config()
This function also only deals with dataclasses as schemas, so that option will never work. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 5f3f5d2 commit b03ffd7

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This release includes a new `ConfigManager` class to simplify managing the confi
3232

3333
+ The `base_schema` argument is now keyword-only and defaults to `BaseConfigSchema` (and because of this, it uses `unknown=EXCLUDE` by default).
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.
35+
+ Will now raise a `ValueError` if `unknown` is set to `INCLUDE` in `marshmallow_load_kwargs`.
3536

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

src/frequenz/sdk/config/_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def load_config(
7272
Returns:
7373
The loaded configuration as an instance of the configuration class.
7474
"""
75+
_validate_load_kwargs(marshmallow_load_kwargs)
76+
7577
instance = class_schema(cls, base_schema)().load(
7678
config, **(marshmallow_load_kwargs or {})
7779
)

0 commit comments

Comments
 (0)