Conversation
…rt ID endpoints The `collapse` query parameter is already supported server-side by GroupDetailsEndpoint and ShortIdLookupEndpoint, but was undocumented. Without docs, the auto-generated `@sentry/api` SDK types this as `query?: never`, blocking SDK consumers from passing it. Mirror the enum used by the existing list endpoint (`OrganizationGroupIndexEndpoint`) so the generated SDK is consistent across detail and list shapes. Reuses `IssueParams.GROUP_INDEX_COLLAPSE` on the spectacular side; mirrors the same enum in the hand-written deprecated JSON path. Refs getsentry/sentry-api-schema#63
When the format hook receives a file path that .oxfmtrc.json's ignorePatterns then filters out (e.g. api-docs/**/*.json), oxfmt errors with 'Expected at least one target file' instead of treating it as a no-op. This blocks pre-commit lint CI on every PR touching api-docs JSON sources, including the previous commit on this branch. Mirror the relevant ignorePatterns entry as a hook-level exclude so prek doesn't invoke oxfmt for these files at all.
BYK
approved these changes
Apr 29, 2026
3 tasks
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
…rt ID endpoints (#114279) ## Summary - Documents the `collapse` query parameter on `GET /api/0/organizations/{organization_id_or_slug}/issues/{issue_id}/` and `GET /api/0/organizations/{organization_id_or_slug}/shortids/{issue_id}/`. Both endpoints already accept this parameter server-side (see `GroupDetailsEndpoint.get` calling `request.GET.getlist("collapse", [])`); this PR is documentation-only. - Without these doc entries the auto-generated `@sentry/api` SDK types the query as `query?: never`, blocking SDK consumers from passing `collapse`. - Enum `["stats", "lifetime", "base", "unhandled", "filtered"]` mirrors the existing `OrganizationGroupIndexEndpoint` (list) entry exactly so the generated SDK stays consistent across list/detail shapes. Closes getsentry/sentry-api-schema#63 ## Files changed - `api-docs/paths/events/issue-details.json` — adds the `collapse` parameter to the `get` operation only. `put` and `delete` left untouched. - `src/sentry/issues/endpoints/organization_shortid.py` — imports `IssueParams` and appends `IssueParams.GROUP_INDEX_COLLAPSE` to the `extend_schema` `parameters=[...]` list. Reuses the existing reusable param defined in `src/sentry/apidocs/parameters.py:393`. - `.pre-commit-config.yaml` — adds `exclude: ^api-docs/.*\.json$` to the `format` hook to mirror `.oxfmtrc.json`'s `ignorePatterns`. Without this, oxfmt errors with `Expected at least one target file` whenever a contributor edits an `api-docs/**/*.json` source, blocking the `pre-commit lint` CI check on every such PR. Tiny tooling fix, but required to land this PR green and unblocks any future api-docs JSON edits. The two API-docs source-of-truth files differ because the two endpoints' OpenAPI schemas come from different generators (hand-written JSON vs drf-spectacular `extend_schema`). ## Verification - `make build-api-docs` regenerates `tests/apidocs/openapi-spectacular.json` and `tests/apidocs/openapi-derefed.json` (both gitignored build artifacts, not committed). The `getsentry/sentry-api-schema` repo is the canonical sync point for the published spec. - `pytest -n3 -svv --reuse-db tests/apidocs/ -x` — all 74 tests pass against the regenerated derefed schema. - Sanity-checked the regenerated derefed JSON: both endpoint paths' `get.parameters` now include a `collapse` entry with the expected enum values (drf-spectacular alphabetizes; the deprecated JSON path preserves the listed order). ## Note on the optional schema diff CI check - **`(Optional) Shows the difference between the prod and dev schema`** — fails by design; that check exits non-zero whenever the dev schema differs from prod, which is exactly what this PR is trying to do (it diff-prints the new `collapse` parameter on both paths). Marked `(Optional)` for that reason. ## Out of scope - Not adding `expand` — separate concern; can be a follow-up. - Not editing `GroupDetailsEndpoint` docstring docs (that generates the private/internal schema). - Not changing the `put`/`delete` operations on `issue-details.json`.
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
collapsequery parameter onGET /api/0/organizations/{organization_id_or_slug}/issues/{issue_id}/andGET /api/0/organizations/{organization_id_or_slug}/shortids/{issue_id}/. Both endpoints already accept this parameter server-side (seeGroupDetailsEndpoint.getcallingrequest.GET.getlist("collapse", [])); this PR is documentation-only.@sentry/apiSDK types the query asquery?: never, blocking SDK consumers from passingcollapse.["stats", "lifetime", "base", "unhandled", "filtered"]mirrors the existingOrganizationGroupIndexEndpoint(list) entry exactly so the generated SDK stays consistent across list/detail shapes.Closes getsentry/sentry-api-schema#63
Files changed
api-docs/paths/events/issue-details.json— adds thecollapseparameter to thegetoperation only.putanddeleteleft untouched.src/sentry/issues/endpoints/organization_shortid.py— importsIssueParamsand appendsIssueParams.GROUP_INDEX_COLLAPSEto theextend_schemaparameters=[...]list. Reuses the existing reusable param defined insrc/sentry/apidocs/parameters.py:393..pre-commit-config.yaml— addsexclude: ^api-docs/.*\.json$to theformathook to mirror.oxfmtrc.json'signorePatterns. Without this, oxfmt errors withExpected at least one target filewhenever a contributor edits anapi-docs/**/*.jsonsource, blocking thepre-commit lintCI check on every such PR. Tiny tooling fix, but required to land this PR green and unblocks any future api-docs JSON edits.The two API-docs source-of-truth files differ because the two endpoints' OpenAPI schemas come from different generators (hand-written JSON vs drf-spectacular
extend_schema).Verification
make build-api-docsregeneratestests/apidocs/openapi-spectacular.jsonandtests/apidocs/openapi-derefed.json(both gitignored build artifacts, not committed). Thegetsentry/sentry-api-schemarepo is the canonical sync point for the published spec.pytest -n3 -svv --reuse-db tests/apidocs/ -x— all 74 tests pass against the regenerated derefed schema.get.parametersnow include acollapseentry with the expected enum values (drf-spectacular alphabetizes; the deprecated JSON path preserves the listed order).Note on the optional schema diff CI check
(Optional) Shows the difference between the prod and dev schema— fails by design; that check exits non-zero whenever the dev schema differs from prod, which is exactly what this PR is trying to do (it diff-prints the newcollapseparameter on both paths). Marked(Optional)for that reason.Out of scope
expand— separate concern; can be a follow-up.GroupDetailsEndpointdocstring docs (that generates the private/internal schema).put/deleteoperations onissue-details.json.