Skip to content

feat(api): Add the generated frontend API contracts - #129590

Draft
billyvg wants to merge 3 commits into
billyvg/feat/api-contracts-to-typescriptfrom
billyvg/feat/api-contracts-generated
Draft

billyvg wants to merge 3 commits into
billyvg/feat/api-contracts-to-typescriptfrom
billyvg/feat/api-contracts-generated

Conversation

@billyvg

@billyvg billyvg commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Adds static/app/utils/api/apiContracts.generated.ts, generated with make build-api-contracts from the PR below. It has 459 component types, and an ApiMapping with response types for 386 methods on 296 routes. Nothing imports it yet; #129593 adds apiOptions.contract(), which reads it.

The knip entry keeps the file's component types from being reported as unused exports while call sites adopt them.

It was regenerated with --validate after #129568 landed. #129766 regenerates it in CI on backend changes; until that lands, run make build-api-contracts after backend response changes.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

decision-model-linter

Not fully checked

Findings may be missing for these files:

  • warn static/app/utils/api/apiContracts.generated.ts (api): too large for one call, so the end was not checked
  • warn static/app/utils/api/apiContracts.generated.ts (audit): too large for one call, so the end was not checked
  • warn static/app/utils/api/apiContracts.generated.ts (frontend): too large for one call, so the end was not checked
  • warn static/app/utils/api/apiContracts.generated.ts (security): too large for one call, so the end was not checked
  • warn static/app/utils/api/apiContracts.generated.ts (voice): too large for one call, so the end was not checked
  • warn static/app/utils/api/apiContracts.generated.ts (voice): too large for one call, so the end was not checked
  • warn static/app/utils/api/apiContracts.generated.ts (voice): too large for one call, so the end was not checked

decision-model-linter: 7 calls on 1 file, 248,401 input tokens, $0.01, model typesafe/jev-1.13-20260917

@linear-code

linear-code Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

ENG-8962

CW-3042

@billyvg
billyvg force-pushed the billyvg/feat/api-contracts-generated branch from 17d1fc8 to b5413db Compare November 3, 2026 20:44
@billyvg
billyvg force-pushed the billyvg/feat/api-contracts-to-typescript branch from 4cd9af6 to 1bfb1e5 Compare November 3, 2026 20:44
Generate static/app/utils/api/apiContracts.generated.ts with `make build-api-contracts`, and
list it as a knip entry point so its component types aren't reported as unused exports
while call sites adopt them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment on lines +11633 to +11645
integrationId: number | null;
organizationId: number;
projects: number[];
sentryAppId: number | null;
serviceType: string | null;
targetDisplay: string | null;
targetIdentifier: string | null;
targetType: string | null;
triggerType: string;
};

/**
* Allows parameters to be defi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't highlight the entire thing but this is repeated in multiple places. how can we get the generator to make sure this is a type alias?

Comment on lines +16902 to +16925
groups: Array<{
by: Record<string, unknown>;
series: Record<string, unknown>;
totals: Record<string, unknown>;
}>;
intervals: string[];
start: string;
};

export type OutgoingNotificationAction = {
id: number;
integrationId: number | null;
organizationId: number;
projects: number[];
sentryAppId: number | null;
serviceType: string | null;
targetDisplay: string | null;
targetIdentifier: string | null;
targetType: string | null;
triggerType: string;
};

/**
* Allows parameters to be defi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these endpoint types use type aliases, but some of them (like this one), does not. How can we ensure that our generator will always use type aliases?

billyvg and others added 2 commits November 3, 2026 17:52
Regenerated with `make build-api-contracts` after the generator started
naming every ApiMapping response type and declaring repeated enums once.
ApiMapping now holds only type names; the 21 responses it spelled out are
declared as `<OperationId>Response`, and the 598 timezones, among 53
repeated enums, are declared once, as `TimezoneEnum`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — a23c041e Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant