Skip to content

fix(user-management): Expose nested user on OrganizationMembership - #1732

Open
gjtorikian wants to merge 1 commit into
mainfrom
fix/1608-organization-membership-user
Open

gjtorikian wants to merge 1 commit into
mainfrom
fix/1608-organization-membership-user

Conversation

@gjtorikian

Copy link
Copy Markdown
Contributor

Description

GET /user_management/organization_memberships (and the single get, create, update, deactivate and reactivate endpoints) return a nested user object; the OpenAPI spec lists user as required on UserlandUserOrganizationMembership. The SDK's deserializeOrganizationMembership dropped it, so consumers had to make a separate getUser call per membership to reach user.email or user.externalId.

  • Add user?: User to OrganizationMembership and user?: UserResponse to OrganizationMembershipResponse.
  • Deserialize it with the existing deserializeUser when present.
  • Nest the user fixture in the membership fixtures and assert the camelCased user on get and list; add a test that the key is omitted when the payload has no user.

user is optional rather than required because the same deserializer handles organization_membership.* event payloads and action contexts, which the spec defines without a nested user. Additive and non-breaking for existing consumers.

Fixes #1608

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

The Organization Membership endpoints return a nested `user` object
(the OpenAPI spec lists it as required on
`UserlandUserOrganizationMembership`), but
`deserializeOrganizationMembership` dropped it. Consumers iterating
memberships had to make a separate `getUser` call per membership just
to reach `user.email` or `user.externalId`.

Add `user?: User` to `OrganizationMembership` (and `user?: UserResponse`
to the response type) and deserialize it with `deserializeUser` when
present. It stays optional because the same deserializer handles
`organization_membership.*` event payloads and action contexts, which do
not include the nested user.

Fixes #1608
@gjtorikian
gjtorikian requested review from a team as code owners October 20, 2026 21:17
@gjtorikian
gjtorikian requested a review from imkesin October 20, 2026 21:17
@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Exposes the nested user returned by organization membership endpoints.

  • Organization memberships now include their nested user when available.

No actionable issues found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix(user-management): Expose nested user..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Expose nested user on OrganizationMembership in the Node SDK (User Management)

1 participant