MCPcopy Create free account
hub / github.com/ShipSecAI/studio / generateOpenApi

Function generateOpenApi

backend/scripts/generate-openapi.ts:10–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8import { cleanupOpenApiDoc } from 'nestjs-zod';
9
10async function generateOpenApi() {
11 // Skip ingest services that require external connections during OpenAPI generation
12 process.env.SKIP_INGEST_SERVICES = 'true';
13 process.env.SHIPSEC_SKIP_MIGRATION_CHECK = 'true';
14
15 const { AppModule } = await import('../src/app.module');
16
17 const app = await NestFactory.create(AppModule, {
18 logger: ['error', 'warn'],
19 });
20
21 // Set global prefix to match production
22 app.setGlobalPrefix('api/v1');
23
24 const config = new DocumentBuilder()
25 .setTitle('ShipSec Studio API')
26 .setDescription('ShipSec backend API specification')
27 .setVersion('0.1.0')
28 .addServer('/api/v1', 'API v1')
29 .build();
30
31 const document = SwaggerModule.createDocument(app, config);
32 const cleaned = cleanupOpenApiDoc(document);
33 const repoRootSpecPath = join(__dirname, '..', '..', 'openapi.json');
34 const payload = JSON.stringify(cleaned, null, 2);
35
36 writeFileSync(repoRootSpecPath, payload);
37 await app.close();
38}
39
40console.log('Script started');
41generateOpenApi()

Callers 1

Calls 2

createMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected