Skip to content

Add CI check to detect drift between backend OpenAPI spec and generated frontend types #7089

@cstns

Description

@cstns

Description

PR #7067 introduced auto-generated TypeScript types from the backend OpenAPI spec via npm run generate:types. The pipeline:

  1. scripts/dump-openapi.js boots the app, extracts the live OpenAPI spec → openapi.json
  2. openapi-typescript converts that into frontend/src/types/generated.ts

The generated types are committed, but there is no automated check to ensure they stay in sync with the backend. If someone changes a backend schema without re-running npm run generate:types, generated.ts silently drifts from the actual API.

As noted in this discussion:

"we need to find a way, maybe through CI, to have this run/checked if it's in sync with the backend. I'm not to be trusted to remember to keep them in sync and I think we should expect anyone to."

Requirement

Add a CI job that:

  1. Runs npm run generate:types (boots the app, dumps the OpenAPI spec, regenerates generated.ts)
  2. Checks for uncommitted changes via git diff --exit-code frontend/src/types/generated.ts openapi.json
  3. Fails the build if the committed types don't match what the backend currently produces

Epic/Story

7067

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

Metadata

Metadata

Assignees

Labels

taskA piece of work that isn't necessarily tied to a specific Epic or Story.time:45m

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions