-
Notifications
You must be signed in to change notification settings - Fork 25
Add custom_attributes field to OrganizationMembership #524
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
base: main
Are you sure you want to change the base?
Conversation
- 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>
Greptile OverviewGreptile SummaryThis PR adds the Key Changes:
Issues Found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant IDP as Identity Provider
participant API as WorkOS API
participant SDK as Python SDK
participant App as Application Code
IDP->>API: Provides user attributes<br/>(department, employee_id, etc.)
Note over API: Stores as customAttributes<br/>in organizationMembership
App->>SDK: list_organization_memberships()
SDK->>API: GET /organization_memberships
API->>SDK: Returns JSON with customAttributes
Note over SDK: Deserializes to<br/>OrganizationMembership.idp_attributes
SDK->>App: OrganizationMembership object
Note over App: Access IDP attributes:<br/>membership.idp_attributes["department"]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 3 comments
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>
| role: OrganizationMembershipRole | ||
| roles: Optional[Sequence[OrganizationMembershipRole]] = None | ||
| status: LiteralOrUntyped[OrganizationMembershipStatus] | ||
| custom_attributes: Dict[str, Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've been preferring to use Mapping instead of Dict for these read-only cases:
| custom_attributes: Dict[str, Any] | |
| custom_attributes: Mapping[str, Any] |
Summary
Adds
custom_attributesfield toOrganizationMembershipmodel to expose custom attributes from identity providers.Changes
custom_attributesfield to OrganizationMembership type/model{}API Field Details
The field will be present in:
JSON field name:
custom_attributes(snake_case)