Skip to content
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

Update MinimalOrganizationDomain type #373

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 1 addition & 3 deletions tests/test_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ def test_unrecognized_webhook_type_returns_untyped_webhook(
assert type(result).__name__ == "UntypedWebhook"
assert result.dict() == json.loads(mock_unknown_webhook_body)

# TODO: This test should be updated in the next major version to expect
# a DirectoryActivatedWebhook return type.
def test_validate_dsync_activated_event(self):
event_body = {
"id": "event_01J8SX5FTXYD2YFWVTGJY49EM6",
Expand All @@ -152,5 +150,5 @@ def test_validate_dsync_activated_event(self):
}

result = WebhookTypeAdapter.validate_json(json.dumps(event_body))
assert type(result).__name__ == "UntypedWebhook"
assert type(result).__name__ == "DirectoryActivatedWebhook"
assert result.dict() == event_body
3 changes: 1 addition & 2 deletions tests/utils/fixtures/mock_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from workos.types.events import DirectoryActivatedEvent
from workos.types.events.directory_payload_with_legacy_fields import (
DirectoryPayloadWithLegacyFields,
DirectoryPayloadWithLegacyFieldsForEventsApi,
)


Expand All @@ -14,7 +13,7 @@ def __init__(self, id):
object="event",
id=id,
event="dsync.activated",
data=DirectoryPayloadWithLegacyFieldsForEventsApi(
data=DirectoryPayloadWithLegacyFields(
object="directory",
id="dir_1234",
organization_id="organization_id",
Expand Down
15 changes: 0 additions & 15 deletions workos/types/events/directory_payload_with_legacy_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@


class MinimalOrganizationDomain(WorkOSModel):
id: str
# TODO: This should be domain: str in the
# next major version to fix object parsing.
organization_id: str
object: Literal["organization_domain"]


# TODO: This class should be removed in the next major version once MinimalOrganizationDomain is updated.
class MinimalOrganizationDomainForEventsApi(WorkOSModel):
id: str
domain: str
object: Literal["organization_domain"]
Expand All @@ -21,9 +12,3 @@ class MinimalOrganizationDomainForEventsApi(WorkOSModel):
class DirectoryPayloadWithLegacyFields(DirectoryPayload):
domains: Sequence[MinimalOrganizationDomain]
external_key: str


# TODO: This class should be removed in the next major version once MinimalOrganizationDomain is updated.
class DirectoryPayloadWithLegacyFieldsForEventsApi(DirectoryPayload):
domains: Sequence[MinimalOrganizationDomainForEventsApi]
external_key: str
3 changes: 1 addition & 2 deletions workos/types/events/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from workos.types.events.directory_payload import DirectoryPayload
from workos.types.events.directory_payload_with_legacy_fields import (
DirectoryPayloadWithLegacyFields,
DirectoryPayloadWithLegacyFieldsForEventsApi,
)
from workos.types.events.directory_user_with_previous_attributes import (
DirectoryUserWithPreviousAttributes,
Expand Down Expand Up @@ -120,7 +119,7 @@ class ConnectionDeletedEvent(EventModel[Connection]):
event: Literal["connection.deleted"]


class DirectoryActivatedEvent(EventModel[DirectoryPayloadWithLegacyFieldsForEventsApi]):
class DirectoryActivatedEvent(EventModel[DirectoryPayloadWithLegacyFields]):
event: Literal["dsync.activated"]


Expand Down
3 changes: 0 additions & 3 deletions workos/types/events/event_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from workos.types.events.directory_payload import DirectoryPayload
from workos.types.events.directory_payload_with_legacy_fields import (
DirectoryPayloadWithLegacyFields,
DirectoryPayloadWithLegacyFieldsForEventsApi,
)
from workos.types.events.directory_user_with_previous_attributes import (
DirectoryUserWithPreviousAttributes,
Expand Down Expand Up @@ -64,8 +63,6 @@
ConnectionPayloadWithLegacyFields,
DirectoryPayload,
DirectoryPayloadWithLegacyFields,
# TODO: Remove once merged with DirectoryPayloadWithLegacyFields in next major release.
DirectoryPayloadWithLegacyFieldsForEventsApi,
DirectoryGroup,
DirectoryGroupWithPreviousAttributes,
DirectoryUser,
Expand Down
Loading