Skip to content

Commit 1fdda5f

Browse files
ajworkosclaude
andauthored
Add custom_attributes field to OrganizationMembership (#524)
* Add idp_attributes field to OrganizationMembership - Add idp_attributes: dict[str, Any] to OrganizationMembership model - Update MockOrganizationMembership fixture - All organization_membership tests pass This change adds support for IDP custom attributes on organization memberships, which are sourced from the identity provider and stored as customAttributes in the API. Related to workos/workos PR #50470 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Fix Python 3.8 compatibility for idp_attributes type Use Dict[str, Any] instead of dict[str, Any] for Python 3.8 compatibility. The lowercase dict syntax is only available in Python 3.9+. Fixes issue identified by Greptile bot review. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Rename idp_attributes to custom_attributes * Use Mapping instead of Dict for read-only custom_attributes --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 57978c1 commit 1fdda5f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/workos/types/user_management/organization_membership.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Literal, Sequence, Optional
1+
from typing import Any, Literal, Mapping, Optional, Sequence
22
from typing_extensions import TypedDict
33

44
from workos.types.workos_model import WorkOSModel
@@ -21,5 +21,6 @@ class OrganizationMembership(WorkOSModel):
2121
role: OrganizationMembershipRole
2222
roles: Optional[Sequence[OrganizationMembershipRole]] = None
2323
status: LiteralOrUntyped[OrganizationMembershipStatus]
24+
custom_attributes: Mapping[str, Any]
2425
created_at: str
2526
updated_at: str

tests/utils/fixtures/mock_organization_membership.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def __init__(self, id):
1313
organization_id="org_67890",
1414
status="active",
1515
role={"slug": "member"},
16+
custom_attributes={},
1617
created_at=now,
1718
updated_at=now,
1819
)

0 commit comments

Comments
 (0)