feat: Add roles field to OrganizationMembership models#671
Conversation
Add optional roles: List[SlimRole] field to OrganizationMembership and UserOrganizationMembershipBaseListData models, matching the API response and the existing pattern in OrganizationMembershipCreatedData (events). The API returns both role (singular, for backward compatibility) and roles (array, for multiple role support). Previously only the singular role field was exposed on these models. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Original prompt from drew.emery
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryThis PR adds the
Confidence Score: 4/5The functional changes are correct and consistent with the existing codebase, but both edited files carry The src/workos/organization_membership/models/organization_membership.py and src/workos/common/models/user_organization_membership_base_list_data.py — both are oagen-generated files edited without regeneration-safe markers. Important Files Changed
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Acknowledged — these files are auto-generated by |
Description
The
OrganizationMembershipmodel only exposedrole: SlimRole(singular), but the API also returnsroles: List[SlimRole]for multiple-role support. The event model (OrganizationMembershipCreatedData) already had this field — this PR adds it to the two remaining models:OrganizationMembership— used bylist_organization_memberships,get_organization_membership,create_organization_membership, etc.UserOrganizationMembershipBaseListData— used by authorization and groups listing endpointsThe field is
Optional[List[SlimRole]](defaults toNone), matching the existing pattern inOrganizationMembershipCreatedData. Backward compatible —roleis unchanged, androlesgracefully handles absence from older API responses.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
Link to Devin session: https://app.devin.ai/sessions/896e93121dcd42839221cfd4cebfec33
Requested by: @ethinallen