Phase 1 complete

This commit is contained in:
GW_MC
2026-02-24 10:34:55 +00:00
parent 630b60d7e2
commit 8714d6bd22
112 changed files with 11063 additions and 73 deletions

View File

@@ -0,0 +1,42 @@
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './src/app.module';
import * as fs from 'fs';
import * as path from 'path';
async function generateOpenApi() {
// Create app without starting the server
const app = await NestFactory.create(AppModule, {
logger: false, // Suppress logs during generation
});
app.setGlobalPrefix('api');
const config = new DocumentBuilder()
.setTitle('DreamChat API')
.setDescription('The DreamChat API documentation')
.setVersion('1.0.0')
.addBearerAuth()
.build();
const document = SwaggerModule.createDocument(app, config);
// Ensure the output directory exists
const outputDir = path.join(__dirname, '..', '..', 'openapi');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
// Write the spec file
const outputPath = path.join(outputDir, 'openapi.json');
fs.writeFileSync(outputPath, JSON.stringify(document, null, 2));
console.log(`📄 OpenAPI spec written to: ${outputPath}`);
await app.close();
process.exit(0);
}
generateOpenApi().catch((err) => {
console.error('Failed to generate OpenAPI spec:', err);
process.exit(1);
});