-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Package version
1.4.1
Node.js and npm version
v18.17.0 / v9.6.7
Sample Code (to reproduce the issue)
I am trying to generate swagger.yaml file by setting format : '.yaml' inside option section of https://github.com/reg2005/adonis5-swagger/blob/master/templates/config.txt
options: {
definition: {
openapi: '3.0.0',
info: {
title: 'Application with swagger docs',
version: '1.0.0',
description: 'My application with swagger docs'
}
},
apis: [
'app/**/*.ts',
'docs/swagger/**/*.yml',
'start/routes.ts'
],
basePath: '/',
format:'.yaml'
},
specFilePath: 'docs/swagger.yaml'
but I am getting JSON stringify yaml data .
while debugging we found that, below code under run function in https://github.com/reg2005/adonis5-swagger/blob/master/commands/GenerateSwaggerFile.ts file is always stringify the swaggerFileContent
const filePath = join(this.application.appRoot, this.config.get('swagger.specFilePath'))
await fs.writeFile(filePath, JSON.stringify(swaggerFileContent))
can we have some kind of handling depending on options.format whether to stringify swaggerFileContent or not. something like below
const filePath = join(this.application.appRoot, this.config.get('swagger.specFilePath'))
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)
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels