| name | backend-openapi |
| description | Use when consumers need an OpenAPI spec for the API: generate an OpenAPI specification from the API routes and serve it for consumers. |
| slipstream | {"category":"backend","requires":["backend-zod-validation"],"verification":{"kind":"command","description":"The spec is valid JSON.","command":"node -e \"JSON.parse(require('fs').readFileSync('{{apiDir}}/openapi.json','utf8'))\""},"tags":["api","docs"]} |
Overview
Generate an OpenAPI specification from the API routes and serve it for consumers.
Steps
- Derive request and response schemas from the existing Zod schemas.
- Emit
openapi.json and serve it at /openapi.json.
- Link the document from the project README.
Verify
Parse openapi.json to confirm it is valid JSON, then load it in an OpenAPI viewer to confirm routes appear.