Skip to content

feat(api-docs): document collapse query param on issue detail and short ID endpoints#114279

Merged
BYK merged 3 commits intomasterfrom
api-docs/collapse-on-issue-detail-and-shortid
Apr 29, 2026
Merged

feat(api-docs): document collapse query param on issue detail and short ID endpoints#114279
BYK merged 3 commits intomasterfrom
api-docs/collapse-on-issue-detail-and-shortid

Conversation

@MathurAditya724
Copy link
Copy Markdown
Member

@MathurAditya724 MathurAditya724 commented Apr 29, 2026

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.

…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
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 29, 2026
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.
@MathurAditya724 MathurAditya724 marked this pull request as ready for review April 29, 2026 04:28
@MathurAditya724 MathurAditya724 requested review from a team as code owners April 29, 2026 04:28
@BYK BYK merged commit 1ad085d into master Apr 29, 2026
60 of 61 checks passed
@BYK BYK deleted the api-docs/collapse-on-issue-detail-and-shortid branch April 29, 2026 05:23
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add collapse query parameter to issue detail and short ID resolution endpoints

2 participants