Skip to content

Generate OpenAPI from Zod for the integrator API - #143

Merged
wasimxyz merged 4 commits into
stagingfrom
openapi-integrator-schema
Jul 14, 2026
Merged

Generate OpenAPI from Zod for the integrator API#143
wasimxyz merged 4 commits into
stagingfrom
openapi-integrator-schema

Conversation

@wasimxyz

@wasimxyz wasimxyz commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Zod request/response schemas and @asteasolutions/zod-to-openapi path registrations for the PAT/integrator /api/v1 surface
  • Validate write-route bodies with those same schemas
  • Serve the OpenAPI 3.1 document from unauthenticated GET /api/v1/openapi.json as a build-time static route (force-static) computed from Zod (no committed openapi.json)
  • Keep optional npm run openapi:generate / make openapi-generate for local dumps; output is gitignored

Test plan

  • curl localhost:3000/api/v1/openapi.json returns OpenAPI 3.1 with /instruments and document tags
  • After next build + next start, the same URL still serves the schema (static)
  • npm run test:unit -- tests/unit/openapi-document.test.ts
  • Spot-check a write route (e.g. POST /instruments) still rejects invalid bodies with nested { error: { code, message } }
  • Confirm web/openapi.json is not tracked (git check-ignore -v web/openapi.json after generating)
  • make check-all

Introduce zod-to-openapi schemas for the integrator REST surface, validate write-route bodies with the same schemas, and publish a committed plus live OpenAPI 3.1 document for the docs site to consume.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
data-hub Building Building Preview, Comment Jul 14, 2026 5:33am

Request Review

Drop the checked-in schema artifact, gitignore local generate output, and mark GET /api/v1/openapi.json as force-static so deploys bake the document from Zod.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align restore/archive scopes with the routes, require non-empty file_ids, trim run_id and display_name, and emit required integer path params instead of optional coerced numbers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document accurate response schemas for every v1 operation that previously
used z.unknown(), correcting existing schemas (runDetail, runListItem,
fileDetail, watcherDetail) and the commentId param that drifted from the
real handler output. Add schema.parse() drift assertions to the happy-path
integration tests so responses are checked against their documented shapes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@wasimxyz
wasimxyz merged commit 45c816a into staging Jul 14, 2026
7 checks passed
@wasimxyz
wasimxyz deleted the openapi-integrator-schema branch July 14, 2026 05:36
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.

1 participant