Skip to content

Commit

Permalink
Add None init for Optional fields (#273)
Browse files Browse the repository at this point in the history
This PR addresses a bug that causes Event deserialization to break. This is because we should init all Optional fields to None.
  • Loading branch information
mrashed-dev authored Sep 26, 2023
1 parent f38a696 commit 3fc208a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------
Expand Down
12 changes: 6 additions & 6 deletions nylas/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,7 +50,7 @@ class EmailName:
"""

email: str
name: Optional[str]
name: Optional[str] = None


@dataclass_json
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3fc208a

Please sign in to comment.