File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
"""Electric Bills."""
2
2
3
3
from dataclasses import dataclass , field
4
+ from typing import Optional
4
5
5
6
from mashumaro import DataClassDictMixin , field_options
6
7
from mashumaro .codecs import BasicDecoder
47
48
class ElectricBill (DataClassDictMixin ):
48
49
total_amount_to_pay : float = field (metadata = field_options (alias = "totalAmountToPay" ))
49
50
total_invoices_to_pay : int = field (metadata = field_options (alias = "totalInvoicesToPay" ))
50
- last_date_to_pay : str = field (metadata = field_options (alias = "lastDateToPay" ))
51
51
invoices : list [Invoice ]
52
+ last_date_to_pay : Optional [str ] = field (metadata = field_options (alias = "lastDateToPay" ), default = None )
52
53
53
54
54
55
decoder = BasicDecoder (ResponseWithDescriptor [ElectricBill ])
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class ResponseDescriptor(DataClassDictMixin):
12
12
13
13
is_success : bool = field (metadata = field_options (alias = "isSuccess" ))
14
14
code : Optional [str ]
15
- description : Optional [str ]
15
+ description : Optional [str ] = None
16
16
17
17
18
18
@dataclass
@@ -34,5 +34,5 @@ class ErrorResponseDescriptor(DataClassDictMixin):
34
34
class ResponseWithDescriptor (Generic [T ], DataClassDictMixin ):
35
35
"""Response With Descriptor"""
36
36
37
- data : Optional [T ]
38
37
response_descriptor : ResponseDescriptor = field (metadata = field_options (alias = RESPONSE_DESCRIPTOR_FIELD ))
38
+ data : Optional [T ] = None
You can’t perform that action at this time.
0 commit comments