Generated Code

Generated Code

Owner: Engineering Last reviewed: 2026-Q2

This page defines how generated files are produced, reviewed, and committed.

OpenAPI And Orval

  • Backend routes and schemas produce the OpenAPI contract.
  • frontend/openapi.json is the frontend input spec.
  • frontend/orval.config.ts generates clients and models into frontend/src/api/generated.
  • Generated files must not be hand-edited.

Regeneration Workflow

When a backend route or schema consumed by the frontend changes:

  1. Export or refresh the backend OpenAPI JSON into frontend/openapi.json.
  2. Run from frontend:
npm run orval
  1. Update thin wrappers in frontend/src/api/* if function names or types changed.
  2. Run npm run build.
  3. Review generated diffs for expected contract changes.

Review Policy

  • Generated diffs should be reviewed for shape and compatibility, not style.
  • Unexpected generated churn usually means the OpenAPI input changed more broadly than intended.
  • Do not hide API breaking changes inside generated diffs; call them out in the PR description.
  • Keep handwritten compatibility wrappers when a generated hook rename would cause broad frontend churn.

Commit Policy

  • Commit generated client changes when the frontend relies on the changed contract.
  • Do not commit generated output from local-only experiments.
  • If generated code changes without an intentional API change, investigate before committing.

Other Generated Or Local Artifacts

  • Do not commit dependency folders, caches, build outputs, virtual environments, .DS_Store, or local machine artifacts.
  • If a generated artifact is required for deployment or development, document its source command and review policy here.