Skip to content

Commit 694ce64

Browse files
committed
Improve load_config documentation
Make it more explicit that this is just a wrapper to external libraries so users should read their documentation in full and which functions are used exactly. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 47adc26 commit 694ce64

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/frequenz/sdk/config/_util.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,22 @@ def load_config(
2222
2323
The configuration class is expected to be a [`dataclasses.dataclass`][], which is
2424
used to create a [`marshmallow.Schema`][] schema to validate the configuration
25-
dictionary.
25+
dictionary using [`marshmallow.Schema.load`][] (which in turn uses the
26+
[`marshmallow.Schema.load`][] method to do the validation and deserialization).
2627
27-
To customize the schema derived from the configuration dataclass, you can use
28-
[`marshmallow_dataclass.dataclass`][] to specify extra metadata.
28+
To customize the schema derived from the configuration dataclass, you can use the
29+
`metadata` key in [`dataclasses.field`][] to pass extra options to
30+
[`marshmallow_dataclass`][] to be used during validation and deserialization.
2931
3032
Additional arguments can be passed to [`marshmallow.Schema.load`][] using keyword
31-
arguments.
33+
arguments `marshmallow_load_kwargs`.
34+
35+
Note:
36+
This method will raise [`marshmallow.ValidationError`][] if the configuration
37+
dictionary is invalid and you have to have in mind all of the gotchas of
38+
[`marshmallow`][] and [`marshmallow_dataclass`][] applies when using this
39+
function. It is recommended to carefully read the documentation of these
40+
libraries.
3241
3342
Args:
3443
cls: The configuration class.

0 commit comments

Comments
 (0)