Repository navigation
fix(memberships): honor the plain statuses param and default to active - #135
Open
ndellosa95 wants to merge 1 commit into
Open
ndellosa95 wants to merge 1 commit into
ndellosa95 wants to merge 1 commit into
Conversation
The organization_memberships list read only `statuses[]=` and returned every status when the param was absent. The Go SDK sends `statuses=`. Parse every array form production accepts and default to active. Move the events array-param parsing into a shared parseArrayParam helper so both routes read array params the same way. Fixes workos#134 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
statuses param and default to active on organization_memberships list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /user_management/organization_membershipsread thestatusesfilter only fromstatuses[]=. The Go SDK sendsstatuses=active, so the emulator ignored the filter. With nostatusesparam, the emulator also returned memberships of every status. Production returns only active memberships.Fixes #134
Behavior
I checked each row against the real WorkOS API in a sandbox environment. Each query also has
organization_id.statusesstatuses=activestatuses[]=activestatuses%5B%5D=activestatuses=active&statuses=inactivestatuses[]=active&statuses[]=inactivestatuses=inactivestatuses=active,inactiveThe emulator now matches every row.
What changed
parseArrayParam(url, name)tosrc/core/pagination.ts. It reads the plain key, repeated keys,name[], indexedname[0], and comma-separated values. This is the logic/eventsalready had inline./eventsnow calls the helper. Its behavior does not change.statusesand defaults to['active']when the request names no status.No other endpoint changes behavior.
Tests
memberships.spec.tscovers every row above./eventstests cover the four array forms through the shared helper.bun test(1352 pass),bun run lint,bun run fmt:check,bun run typecheck,bun run build,node scripts/check-package.mjs,node scripts/smoke-node.mjs, and the codegen andSUPPORTED.mddrift checks all pass.🤖 Generated with Claude Code