mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
* Adds support for auto-openapi doc generation * Adds a swagger route for local development * Adds a script to manually generate the openapi doc (to be used later if we publish to our site, etc...) Ref: HDX-1661
12 lines
449 B
TypeScript
12 lines
449 B
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import swaggerJsdoc from 'swagger-jsdoc';
|
|
|
|
import { swaggerOptions } from '../src/utils/swagger';
|
|
|
|
const specs = swaggerJsdoc(swaggerOptions);
|
|
const outputPath = path.resolve(__dirname, '../../public/openapi.json');
|
|
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
fs.writeFileSync(outputPath, JSON.stringify(specs, null, 2));
|
|
|
|
console.log(`OpenAPI specification written to ${outputPath}`);
|