You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drop support for using marshmallow_dataclas.dataclass directly
`marshmallow_dataclass.dataclass` is intended to be used only when using
`my_dataclass.Schema` to get the schema. But using this is not very
convenient when using type hints as they are not well supported by
`marshmallow`, as the `load()` function can't have hints.
This is actually why `load_config()` exists in the first place, so we
are using `class_schema()` instead, so we don't really need that our
types are decorated with `marshmallow_dataclass`, we can use the
built-in `dataclass` instead, we just need to add the appropriate
metadata if we want more complex validation.
Using `class_shema()` is also necessary to be able to pass a
`base_schema`, which we'll need when we want to use schemas with
custom fields, like the ones provided by `frequenz.quantities`.
Because of this, we just drop support for
`marshmallow_dataclass.dataclass` and we'll require that built-in
dataclasses are used in the future.
Signed-off-by: Leandro Lucarella <[email protected]>
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
## Upgrading
8
8
9
-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9
+
-`frequenz.sdk.config.load_config()` doesn't accept classes decorated with `marshmallow_dataclass.dataclass` anymore. You should use the built-in `dataclasses.dataclass` directly instead, no other changes should be needed, the metadata in the `dataclass` fields will still be used.
0 commit comments