From a75807d34ba80f89ad59f19873bd488df5096328 Mon Sep 17 00:00:00 2001 From: rajeev87y Date: Fri, 20 Dec 2024 15:40:21 +0530 Subject: [PATCH] swagger file generation other than JSON (#1) --- commands/GenerateSwaggerFile.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/commands/GenerateSwaggerFile.ts b/commands/GenerateSwaggerFile.ts index 8b028a4..c7ec285 100644 --- a/commands/GenerateSwaggerFile.ts +++ b/commands/GenerateSwaggerFile.ts @@ -34,6 +34,9 @@ export default class GenerateSwaggerFile extends BaseCommand { } const filePath = join(this.application.appRoot, this.config.get('swagger.specFilePath')) - await fs.writeFile(filePath, JSON.stringify(swaggerFileContent)) - } + if(!this.config.get('swagger.options.format') || this.config.get('swagger.options.format') === '.json') { + await fs.writeFile(filePath, JSON.stringify(swaggerFileContent)) + }else{ + await fs.writeFile(filePath, swaggerFileContent) + } }