Skip to content

Commit

Permalink
Loosen some pydantic constraints for some situations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeckennedy committed Jan 24, 2024
1 parent 341453a commit a833b42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion listmonk/impl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from listmonk import models, urls # noqa: F401

__version__ = '0.1.4'
__version__ = '0.1.5'

from listmonk.errors import ValidationError, OperationNotAllowedError

Expand Down
24 changes: 12 additions & 12 deletions listmonk/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime
import enum
import typing
from typing import Optional, Any

import pydantic
from pydantic import BaseModel, field_serializer
Expand All @@ -13,21 +13,21 @@ class SubscriberStatuses(enum.StrEnum):


class SubscriberStatus(BaseModel):
unconfirmed_count: int = pydantic.Field(alias="unconfirmed")
unconfirmed_count: Optional[int] = pydantic.Field(alias="unconfirmed", default=None)


class MailingList(BaseModel):
id: int
created_at: datetime.datetime
updated_at: datetime.datetime
updated_at: Optional[datetime.datetime] = None
uuid: str
name: str
type: str
optin: str
name: Optional[str] = None
type: Optional[str] = None
optin: Optional[str] = None
tags: list[str]
description: str
subscriber_count: int
subscriber_statuses: SubscriberStatus
description: Optional[str] = None
subscriber_count: Optional[int] = None
subscriber_statuses: Optional[SubscriberStatus] = None


class Subscriber(BaseModel):
Expand All @@ -36,10 +36,10 @@ class Subscriber(BaseModel):
name: str
created_at: datetime.datetime
updated_at: datetime.datetime
uuid: typing.Optional[str] = None
uuid: Optional[str] = None
lists: list[dict] = []
attribs: dict[str, typing.Any] = {}
status: typing.Optional[str] = None
attribs: dict[str, Any] = {}
status: Optional[str] = None

@field_serializer('created_at', 'updated_at')
def serialize_date_times(self, fld: datetime, _info):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"httpx",
"pydantic",
]
version = "0.1.4"
version = "0.1.5"


[project.urls]
Expand Down

0 comments on commit a833b42

Please sign in to comment.