Commit a887ace
committed
Drop support for using
`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]>marshmallow_dataclas.dataclass directly1 parent cd764e9 commit a887ace
2 files changed
+3
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 20 | | |
30 | 21 | | |
31 | 22 | | |
| |||
37 | 28 | | |
38 | 29 | | |
39 | 30 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 31 | | |
52 | 32 | | |
53 | | - | |
| 33 | + | |
54 | 34 | | |
55 | 35 | | |
56 | 36 | | |
| |||
70 | 50 | | |
71 | 51 | | |
72 | 52 | | |
73 | | - | |
| 53 | + | |
74 | 54 | | |
75 | 55 | | |
76 | 56 | | |
0 commit comments