Files
Pradeep Elankumaran 1bdd925371 feat: OpenAPI spec + swagger-stripey docs at /docs (#78)
Auto-generated OpenAPI 3.0 spec from JSDoc annotations on all 31 routes via swagger-jsdoc. Docs at /docs using swagger-stripey. CI split into parallel unit + e2e jobs (133s → 80s).

Supersedes #69. Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-04-25 11:52:02 -07:00

25 lines
715 B
JavaScript

#!/usr/bin/env node
/**
* Generate openapi.json from JSDoc annotations in server.js.
* Run: node scripts/generate-openapi.js
*/
import { writeFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import swaggerJsdoc from 'swagger-jsdoc';
import { swaggerDefinition } from '../lib/openapi.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = join(__dirname, '..');
const spec = swaggerJsdoc({
definition: swaggerDefinition,
apis: [join(root, 'server.js')],
});
const out = join(root, 'openapi.json');
writeFileSync(out, JSON.stringify(spec, null, 2) + '\n');
console.log(`Wrote ${Object.keys(spec.paths).length} paths to openapi.json`);