Skip to content

last_date_to_pay field can be none #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion iec_api/models/electric_bill.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Electric Bills."""

from dataclasses import dataclass, field
from typing import Optional

from mashumaro import DataClassDictMixin, field_options
from mashumaro.codecs import BasicDecoder
Expand Down Expand Up @@ -47,8 +48,8 @@
class ElectricBill(DataClassDictMixin):
total_amount_to_pay: float = field(metadata=field_options(alias="totalAmountToPay"))
total_invoices_to_pay: int = field(metadata=field_options(alias="totalInvoicesToPay"))
last_date_to_pay: str = field(metadata=field_options(alias="lastDateToPay"))
invoices: list[Invoice]
last_date_to_pay: Optional[str] = field(metadata=field_options(alias="lastDateToPay"), default=None)


decoder = BasicDecoder(ResponseWithDescriptor[ElectricBill])
4 changes: 2 additions & 2 deletions iec_api/models/response_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ResponseDescriptor(DataClassDictMixin):

is_success: bool = field(metadata=field_options(alias="isSuccess"))
code: Optional[str]
description: Optional[str]
description: Optional[str] = None


@dataclass
Expand All @@ -34,5 +34,5 @@ class ErrorResponseDescriptor(DataClassDictMixin):
class ResponseWithDescriptor(Generic[T], DataClassDictMixin):
"""Response With Descriptor"""

data: Optional[T]
response_descriptor: ResponseDescriptor = field(metadata=field_options(alias=RESPONSE_DESCRIPTOR_FIELD))
data: Optional[T] = None
Loading