Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* [#114](https://github.com/workos/workos-rust/pull/114) fix(generated): regenerate from spec

**Fixes**
* **[organization_membership](https://workos.com/docs/reference/authkit/organization-membership)**:
* Added `roles` to organization membership models
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b6a68da8bd60c1478e0a86ca97c75448677e8871
1a2f47b20f63f2c8f0eb56bbd2adb3b5947d693a
2 changes: 2 additions & 0 deletions src/models/organization_membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub struct OrganizationMembership {
pub updated_at: String,
/// The primary role assigned to the user within the organization.
pub role: SlimRole,
/// The list of roles assigned to the user within the organization.
pub roles: Vec<SlimRole>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Required Roles Breaks Older Payloads

When the API returns a membership payload with the existing role field but no new roles array, serde treats this non-default Vec as required and fails deserialization with a missing-field error. That can break create_organization_membership, deactivate_organization_membership, and any cached membership JSON produced before this field existed instead of returning the membership object.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/models/organization_membership.rs
Line: 35

Comment:
**Required Roles Breaks Older Payloads**

When the API returns a membership payload with the existing `role` field but no new `roles` array, serde treats this non-default `Vec` as required and fails deserialization with a missing-field error. That can break `create_organization_membership`, `deactivate_organization_membership`, and any cached membership JSON produced before this field existed instead of returning the membership object.

How can I resolve this? If you propose a fix, please make it concise.

/// The user that belongs to the organization through this membership.
pub user: User,
}
2 changes: 2 additions & 0 deletions src/models/user_organization_membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub struct UserOrganizationMembership {
pub updated_at: String,
/// The primary role assigned to the user within the organization.
pub role: SlimRole,
/// The list of roles assigned to the user within the organization.
pub roles: Vec<SlimRole>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Required Roles Breaks Older Payloads

When get_organization_membership, update_organization_membership, or list_organization_memberships receives a response that still only includes the singular role, this required roles field makes deserialization fail with a missing-field error. The SDK then returns an error for an otherwise valid membership response during rollout or for legacy payloads.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/models/user_organization_membership.rs
Line: 35

Comment:
**Required Roles Breaks Older Payloads**

When `get_organization_membership`, `update_organization_membership`, or `list_organization_memberships` receives a response that still only includes the singular `role`, this required `roles` field makes deserialization fail with a missing-field error. The SDK then returns an error for an otherwise valid membership response during rollout or for legacy payloads.

How can I resolve this? If you propose a fix, please make it concise.

/// The user that belongs to the organization through this membership.
pub user: User,
}
7 changes: 6 additions & 1 deletion tests/fixtures/organization_membership.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
"last_sign_in_at": "2025-06-25T19:07:33.155Z",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
},
"roles": [
{
"slug": "admin"
}
]
}
7 changes: 6 additions & 1 deletion tests/fixtures/user_organization_membership.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
"last_sign_in_at": "2025-06-25T19:07:33.155Z",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
},
"roles": [
{
"slug": "admin"
}
]
}
5 changes: 5 additions & 0 deletions tests/fixtures/user_organization_membership_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"role": {
"slug": "admin"
},
"roles": [
{
"slug": "admin"
}
],
"user": {
"object": "user",
"id": "user_01E4ZCR3C56J083X43JQXF3JK5",
Expand Down
Loading