From 3fc208af2fd08d408b92e3d92b1eb91382a89726 Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:22:14 -0400 Subject: [PATCH] Add None init for Optional fields (#273) This PR addresses a bug that causes Event deserialization to break. This is because we should init all Optional fields to None. --- CHANGELOG.md | 1 + nylas/models/events.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ebe9c64..47b0b2aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ nylas-python Changelog v6.0.0b2 ---------------- * Fix inconsistency between Event model and API contract +* Fix bug when deserializing Events with empty optional fields v6.0.0b1 ---------------- diff --git a/nylas/models/events.py b/nylas/models/events.py index ee45f732..60111cdd 100644 --- a/nylas/models/events.py +++ b/nylas/models/events.py @@ -33,9 +33,9 @@ class Participant: email: str status: ParticipantStatus - name: Optional[str] - comment: Optional[str] - phone_number: Optional[str] + name: Optional[str] = None + comment: Optional[str] = None + phone_number: Optional[str] = None @dataclass_json @@ -50,7 +50,7 @@ class EmailName: """ email: str - name: Optional[str] + name: Optional[str] = None @dataclass_json @@ -86,8 +86,8 @@ class Timespan: start_time: int end_time: int - start_timezone: Optional[str] - end_timezone: Optional[str] + start_timezone: Optional[str] = None + end_timezone: Optional[str] = None @dataclass_json