Files
runtime/apps/api/src/generate-openapi.ts
Vedran Jukic 074ef70011 feat: daytona ai (#1775)
Signed-off-by: Vedran <[email protected]>
Signed-off-by: MDzaja <[email protected]>
Signed-off-by: Luka Brecic <[email protected]>
Signed-off-by: Toma Puljak <[email protected]>
Signed-off-by: fabjanvucina <[email protected]>
Signed-off-by: Ivan Dagelic <[email protected]>
Signed-off-by: Goran Draganić <[email protected]>
Signed-off-by: Zoran Zorica <[email protected]>
2025-04-28 19:13:31 +00:00

34 lines
955 B
TypeScript

#!/usr/bin/env ts-node
import * as fs from 'fs'
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { SwaggerModule } from '@nestjs/swagger'
import { getOpenApiConfig } from './openapi.config'
async function generateOpenAPI() {
const app = await NestFactory.create(AppModule, {
logger: ['error'], // Reduce logging noise
})
const config = getOpenApiConfig('http://localhost:3000')
const document = SwaggerModule.createDocument(app, config)
fs.writeFileSync('./dist/apps/api/openapi.json', JSON.stringify(document, null, 2))
await app.close()
console.log('OpenAPI specification generated successfully!')
process.exit(0)
}
// Add timeout to prevent hanging
const timeout = setTimeout(() => {
console.error('Generation timed out after 30 seconds')
process.exit(1)
}, 30000)
// Clear timeout if process exits normally
process.on('exit', () => {
clearTimeout(timeout)
})
generateOpenAPI()