Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"test:smoke": "jest -c tests/smoke/jest.smoke.config.js",
"test:smoke:verbose": "VERBOSE=1 jest -c tests/smoke/jest.smoke.config.js --verbose",
"setup:smoke-user": "ts-node ../scripts/setup-smoke-test-user.ts",
"swagger:export": "ts-node scripts/export-swagger.ts",
"swagger:export": "npm run openapi:generate && ts-node scripts/export-swagger.ts",
"openapi:generate": "ts-node scripts/generate-openapi-paths.ts",
"db:migrate": "supabase db push",
"db:migrate:prod": "supabase db push --db-url \"$PRODUCTION_DB_URL\"",
"db:reset": "supabase db reset",
Expand Down Expand Up @@ -65,6 +66,7 @@
"rate-limit-redis": "^4.3.1",
"redis": "^6.0.0",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1",
"telegraf": "^4.16.3",
"uuid": "^14.0.1",
"web-push": "^3.6.7",
Expand Down
10 changes: 10 additions & 0 deletions backend/scripts/generate-openapi-paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Generates OpenAPI path JSDoc blocks from route comments and registrations.
* Run with: npm run openapi:generate
*/
import * as path from 'path';
import { generateOpenApiPathsFile } from '../src/openapi/route-generator';

const outputPath = path.join(__dirname, '..', 'src', 'openapi', 'generated-paths.ts');
const count = generateOpenApiPathsFile(outputPath);
console.log(`Generated ${count} OpenAPI paths at ${outputPath}`);
6 changes: 6 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ app.get('/health', async (req, res) => {
});

// Swagger Documentation
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
app.get('/api-docs.json', (_req, res) => {
res.setHeader('Content-Type', 'application/json');
res.send(swaggerSpec);
});
// Legacy aliases
app.use('/api/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
app.get('/api/docs.json', (_req, res) => {
res.setHeader('Content-Type', 'application/json');
Expand Down
Loading
Loading