Skip to content

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

@BYK

Description

@BYK

Summary

The retrieveAnIssue (GET /api/0/organizations/{org}/issues/{issue_id}/) and resolveAShortId (GET /api/0/organizations/{org}/shortids/{short_id}/) endpoints accept the collapse query parameter at the server level (same Django view base class as the list endpoint), but the OpenAPI spec does not declare it. This causes the generated @sentry/api SDK to type both endpoints with query?: never, blocking consumers from passing collapse or any other query parameters.

Impact

The Sentry web UI recently saved 100-300ms on issue detail requests by skipping the stats field (fetched from Snuba). SDK consumers who want the same optimization must drop down to raw HTTP requests because the generated types block query params entirely.

The listAnOrganizationSissues list endpoint already declares collapse with values: stats, lifetime, filtered, unhandled, base. The detail endpoints should declare the same parameter.

Workaround

The Sentry CLI works around this by using raw apiRequestToRegion() instead of the SDK's retrieveAnIssue and resolveAShortId for getIssueInOrg and getIssueByShortId: getsentry/cli#551

Expected behavior

Both endpoints should declare the collapse query parameter in the OpenAPI spec so the generated SDK allows passing it:

// Currently blocked by query?: never
const result = await retrieveAnIssue({
  ...config,
  path: { organization_id_or_slug: org, issue_id: id },
  query: { collapse: ['stats', 'lifetime', 'filtered', 'unhandled'] },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions