fix(api): Add missing cursor query parameter to paginated endpoint OpenAPI schemas#109642
Merged
MathurAditya724 merged 2 commits intomasterfrom Mar 2, 2026
Merged
fix(api): Add missing cursor query parameter to paginated endpoint OpenAPI schemas#109642MathurAditya724 merged 2 commits intomasterfrom
MathurAditya724 merged 2 commits intomasterfrom
Conversation
…enAPI schemas Add CursorQueryParam to @extend_schema parameters on 19 paginated API endpoints that support cursor-based pagination at runtime but were missing the cursor parameter in their OpenAPI spec. This is a schema-only change with no runtime behavior modification. Fixes getsentry/sentry-api-schema#59 Fixes getsentry/sentry-api-schema#60
63a4212 to
d9462c3
Compare
JoshFerge
reviewed
Mar 2, 2026
Member
JoshFerge
left a comment
There was a problem hiding this comment.
for some of these endpoints, the api docs may not be based on the in-code tooling, for example the user reports
will need the json there updated
…N API docs 11 endpoints have hand-maintained OpenAPI JSON files in api-docs/paths/ that also need the cursor query parameter. Added PaginationCursor $ref to each file's get.parameters array, matching the existing convention used by service-hooks, project-issues, and issue-hashes.
JoshFerge
approved these changes
Mar 2, 2026
jan-auer
added a commit
that referenced
this pull request
Mar 2, 2026
…ept-encoding * origin/master: (63 commits) fix(api): Add missing cursor query parameter to paginated endpoint OpenAPI schemas (#109642) docs(sentry-apps): Add sentryAppId to sentry-app-installations API schema (#109628) feat(occurrences on eap): Implement double reads from EAP in organization events trace API endpoint (#109391) feat(occurrences on eap): Implement double reads from EAP for reprocessing2 flow (#109345) feat(ci): report backend test fails (#109543) feat(seer): Add signed viewer context header to Seer API requests (#109626) devenv: cleanup devenv-managed uv (#109617) feat(seer): Iterate on the instructions at the top of seer settings pages (#109586) ref(seer): Add typed wrappers for remaining Seer API callsites (#109607) feat(preprod): Make snapshots endpoint org scoped (#109575) chore: capture exception (#109620) fix(formatting): run ruff format (#109618) feat(preprod): Create admin gated recompare snapshots endpoint (#109546) feat(cells): expand locality/cell distinction (#109538) feat(cells): add db migration for synapse (#109615) feat(preprod): Add public install-details endpoint and shared utilities (#109583) fix(tests): Fix flaky test_cross_trace_query_with_spans_and_logs (#109572) fix(grouping): Resolve mypy possibly-undefined errors in grouphash caching (#109602) fix(dashboards): Default axisRange to auto for existing widgets in builder (#109598) fix(billing): Fix category display names in pending changes (#109612) ...
BYK
added a commit
to getsentry/cli
that referenced
this pull request
Mar 2, 2026
…ounds The @sentry/api SDK now has cursor support for all paginated endpoints (sentry-api-schema#59, #60 fixed via getsentry/sentry#109642). Migrated 5 functions from raw HTTP (orgScopedRequestPaginated) to SDK: - listProjects: SDK auto-pagination loop - listProjectsPaginated: SDK + unwrapPaginatedResult - listRepositories: SDK + unwrapResult (was apiRequestToRegion) - listRepositoriesPaginated: SDK + unwrapPaginatedResult - listTeamsPaginated: SDK + unwrapPaginatedResult Removed dead infrastructure: - extractOrgSlugFromEndpoint + regex constants - orgScopedRequestPaginated - orgScopedPaginateAll All list functions now consistently use the SDK with our custom unwrapResult/unwrapPaginatedResult for proper error type preservation.
BYK
added a commit
to getsentry/cli
that referenced
this pull request
Mar 3, 2026
…ounds The @sentry/api SDK now has cursor support for all paginated endpoints (sentry-api-schema#59, #60 fixed via getsentry/sentry#109642). Migrated 5 functions from raw HTTP (orgScopedRequestPaginated) to SDK: - listProjects: SDK auto-pagination loop - listProjectsPaginated: SDK + unwrapPaginatedResult - listRepositories: SDK + unwrapResult (was apiRequestToRegion) - listRepositoriesPaginated: SDK + unwrapPaginatedResult - listTeamsPaginated: SDK + unwrapPaginatedResult Removed dead infrastructure: - extractOrgSlugFromEndpoint + regex constants - orgScopedRequestPaginated - orgScopedPaginateAll All list functions now consistently use the SDK with our custom unwrapResult/unwrapPaginatedResult for proper error type preservation.
BYK
added a commit
to getsentry/cli
that referenced
this pull request
Mar 3, 2026
…orkarounds (#321) ## Summary Upgrades `@sentry/api` from `^0.1.0` to `^0.21.0` and removes the raw-HTTP pagination workarounds we had in place for [sentry-api-schema#59](getsentry/sentry-api-schema#59) and [sentry-api-schema#60](getsentry/sentry-api-schema#60), both fixed by [getsentry/sentry#109642](getsentry/sentry#109642). ## What changed **5 functions** migrated from raw HTTP to SDK calls: | Function | Before | After | |---|---|---| | `listProjects` | `orgScopedPaginateAll` (raw HTTP loop) | SDK loop via `listAnOrganization_sProjects` | | `listProjectsPaginated` | `orgScopedRequestPaginated` | SDK + `unwrapPaginatedResult` | | `listRepositories` | `apiRequestToRegion` | SDK + `unwrapResult` via `listAnOrganization_sRepositories` | | `listRepositoriesPaginated` | `orgScopedRequestPaginated` | SDK + `unwrapPaginatedResult` | | `listTeamsPaginated` | `orgScopedRequestPaginated` | SDK + `unwrapPaginatedResult` | **~105 lines of dead infrastructure removed:** - `extractOrgSlugFromEndpoint` + regex constants - `orgScopedRequestPaginated` - `orgScopedPaginateAll` All list functions now follow the same consistent pattern: SDK call → `unwrapResult` / `unwrapPaginatedResult`.
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
CursorQueryParamto@extend_schemaparameters on 19 paginated API endpoints that support cursor-based pagination at runtime (self.paginate()) but were missing thecursorquery parameter in their OpenAPI speccursorparameter already works at runtime becauseself.paginate()reads it fromrequest.GET; this just makes the OpenAPI spec accurately reflect thatMotivation
The
getsentry/sentry-api-schemarepo (which produces the@sentry/apinpm package) consumes the OpenAPI spec generated from this repo. The missingcursordeclarations cause the generated TypeScript SDK to produce types wherequeryisneveror omitscursor, making type-safe pagination impossible for SDK consumers.Upstream issues:
unwrapResult()discards Link headers, consumers can't paginateEndpoints Modified
Priority 1 — High-impact (actively blocking SDK consumers)
GET /organizations/{org}/repos/src/sentry/integrations/api/endpoints/organization_repositories.pyGET /organizations/{org}/releases/src/sentry/api/endpoints/organization_releases.pyGET /organizations/{org}/members/src/sentry/core/endpoints/organization_member_index.pyGET /organizations/{org}/issues/{issue_id}/events/src/sentry/issues/endpoints/group_events.pyPriority 2 — Other paginated endpoints
GET /organizations/{org}/integrations/organization_integrations_index.pyGET /organizations/{org}/monitors/organization_monitor_index.pyGET /organizations/{org}/monitors/{monitor}/checkins/organization_monitor_checkin_index.pyGET /organizations/{org}/releases/{version}/commits/organization_release_commits.pyGET /organizations/{org}/releases/{version}/deploys/release_deploys.pyGET /organizations/{org}/releases/{version}/files/organization_release_files.pyGET /organizations/{org}/repos/{repo_id}/commits/organization_repository_commits.pyGET /organizations/{org}/sentry-app-installations/sentry_app_installations.pyGET /projects/{org}/{project}/releases/{version}/commits/project_release_commits.pyGET /projects/{org}/{project}/releases/{version}/files/project_release_files.pyGET /projects/{org}/{project}/rules/project_rules.pyGET /projects/{org}/{project}/tags/{key}/values/project_tagkey_values.pyGET /projects/{org}/{project}/teams/project_teams.pyGET /projects/{org}/{project}/user-feedback/project_user_reports.pyGET /projects/{org}/{project}/users/project_users.pyEndpoints from plan intentionally skipped (do NOT paginate)
These were listed in the plan but return full results directly without
self.paginate():OrganizationUserTeamsEndpoint— returnsResponse(serialize(list(queryset), ...))ProjectEnvironmentsEndpoint— returnsResponse(serialize(list(queryset), ...))ProjectMemberIndexEndpoint— returnsResponse(context)with manual sortHow It Works
The
CursorQueryParamserializer is defined insrc/sentry/apidocs/parameters.pyand declares a single optionalcursorstring field. Adding it to@extend_schema(parameters=[...])causesdrf-spectacularto include the cursor query parameter in the generated OpenAPI JSON for that endpoint.Fixes getsentry/sentry-api-schema#59
Fixes getsentry/sentry-api-schema#60