Generate OpenAPI from Zod for the integrator API - #143
Merged
Conversation
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>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@asteasolutions/zod-to-openapipath registrations for the PAT/integrator/api/v1surfaceGET /api/v1/openapi.jsonas a build-time static route (force-static) computed from Zod (no committedopenapi.json)npm run openapi:generate/make openapi-generatefor local dumps; output is gitignoredTest plan
curl localhost:3000/api/v1/openapi.jsonreturns OpenAPI 3.1 with/instrumentsand document tagsnext build+next start, the same URL still serves the schema (static)npm run test:unit -- tests/unit/openapi-document.test.tsPOST /instruments) still rejects invalid bodies with nested{ error: { code, message } }web/openapi.jsonis not tracked (git check-ignore -v web/openapi.jsonafter generating)make check-all