Skip to content

chore(infra) - Add openapi-ts:local script for local API development#1025

Merged
gabrielseco merged 2 commits into
mainfrom
openapi-ts-local-script
May 15, 2026
Merged

chore(infra) - Add openapi-ts:local script for local API development#1025
gabrielseco merged 2 commits into
mainfrom
openapi-ts-local-script

Conversation

@gabrielseco
Copy link
Copy Markdown
Collaborator

@gabrielseco gabrielseco commented May 15, 2026

Human Explanation

This script can help us any time we have to generate types / endpoints locally, this helps us to test BE branches faster

When generating types with this script, avoid merging it to the main branch, types / endpoints should be always generated from the openapi-ts script which generates from production

Summary

This PR extracts the openapi-ts:local script and its dependencies from PR #1009 into a standalone change that can be reviewed and merged independently.

The new script allows developers to generate TypeScript client code from a local OpenAPI gateway instance, which is useful for testing new API endpoints before they're deployed to production.

Changes

  • New script: npm run openapi-ts:local - Generates client code from local gateway
  • New file: openapi-ts.config.local.ts - Configuration for local gateway (localhost:4000)
  • New file: scripts/cleanup-local-openapi.ts - Post-processing script to remove /api/eor prefix from generated URLs
  • Updated: openapi-ts.config.ts - Added clarifying comments about production vs local usage
  • Updated: package.json - Added the new script

Usage

Production API (existing)

npm run openapi-ts

Local Development API (new)

npm run openapi-ts:local

The local script will:

  1. Generate TypeScript client from http://localhost:4000/api/eor/openapi
  2. Remove /api/eor prefix from generated URLs (since the local gateway includes it but production doesn't)
  3. Format the code using oxfmt

Dependencies

This PR only includes the infrastructure for the script. No functional changes to the application code.

Related

Made with Cursor


Note

Low Risk
Low risk: adds a new local-only OpenAPI generation path and a simple post-processing script without changing runtime application behavior; main risk is incorrect URL rewriting in generated clients.

Overview
Adds a new npm run openapi-ts:local flow to generate src/client from a local OpenAPI spec (openapi-ts.config.local.ts pointing at http://localhost:4000/api/eor/openapi).

After generation, a new script (scripts/cleanup-local-openapi.ts) rewrites generated url: '/api/eor/... entries in sdk.gen.ts/types.gen.ts to remove the /api/eor prefix, and openapi-ts.config.ts now documents when to use production vs local generation.

Reviewed by Cursor Bugbot for commit d2fca6d. Bugbot is set up for automated code reviews on this repo. Configure here.

This adds a new npm script `openapi-ts:local` that allows developers to generate TypeScript client code from a local OpenAPI gateway instance.

Changes:
- Add openapi-ts.config.local.ts for local gateway configuration
- Add scripts/cleanup-local-openapi.ts to remove /api/eor prefix from generated URLs
- Add npm script: openapi-ts:local
- Update openapi-ts.config.ts with clarifying comments about production vs local usage

Usage:
- Production: npm run openapi-ts (existing)
- Local development: npm run openapi-ts:local (new)

Co-authored-by: Cursor <cursoragent@cursor.com>
@gabrielseco gabrielseco changed the title Add openapi-ts:local script for local API development chore(infra) - Add openapi-ts:local script for local API development May 15, 2026
@gabrielseco gabrielseco self-assigned this May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 211.73 kB 211.73 kB 0 B (0%) 🟢
Total (raw) 573.95 kB 573.95 kB 0 B (0%) 🟢
CSS (gzip) 20.86 kB 20.86 kB 0 B (0%) 🟢
CSS (raw) 108.83 kB 108.83 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 211.73 kB / 250 kB (84.7%)
  • ✅ Total raw: 573.95 kB / 600 kB (95.7%)
  • ✅ CSS gzipped: 20.86 kB / 25 kB (83.4%)

Largest Files (Top 5)

  1. chunk-5BU3CD2P.js - 14 kB (0 B (0%))
  2. styles.css - 10.43 kB (0 B (0%))
  3. index.css - 10.43 kB (0 B (0%))
  4. index.js - 6.11 kB (0 B (0%))
  5. chunk-ER46UFIU.js - 5.89 kB (0 B (0%))
View All Files (312 total)
File Size (gzip) Change
chunk-5BU3CD2P.js 14 kB 0 B (0%)
styles.css 10.43 kB 0 B (0%)
index.css 10.43 kB 0 B (0%)
index.js 6.11 kB 0 B (0%)
chunk-ER46UFIU.js 5.89 kB 0 B (0%)
chunk-U3PQEGSV.js 5.81 kB 0 B (0%)
chunk-JXAAON7I.js 5.26 kB 0 B (0%)
chunk-PMAIML44.js 4.62 kB 0 B (0%)
chunk-T35SZZ74.js 4.45 kB 0 B (0%)
chunk-3PKL3V6F.js 4.06 kB 0 B (0%)

✅ Bundle size check passed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-gt2f7buvv-remotecom.vercel.app
Latest Commit:d2fca6d

Deployed with vercel-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 90.05% 90.05% 0%
Statements 89.72% 89.72% 0%
Functions 87.73% 87.73% 0%
Branches 80.08% 80.08% 0%

Detailed Breakdown

Lines Coverage
  • Covered: 3693 / 4101
  • Coverage: 90.05%
  • Change: 0% (0 lines)
Statements Coverage
  • Covered: 3753 / 4183
  • Coverage: 89.72%
  • Change: 0% (0 statements)
Functions Coverage
  • Covered: 1001 / 1141
  • Coverage: 87.73%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 2299 / 2871
  • Coverage: 80.08%
  • Change: 0% (0 branches)

✅ Coverage check passed

Comment thread scripts/cleanup-local-openapi.ts Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d2fca6d. Configure here.

Comment thread scripts/cleanup-local-openapi.ts
@gabrielseco gabrielseco merged commit 19f0c7c into main May 15, 2026
10 checks passed
@gabrielseco gabrielseco deleted the openapi-ts-local-script branch May 15, 2026 14:01
@gabrielseco gabrielseco mentioned this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants