Skip to content

Unable to generate the swagger.json file #31

Description

@abdullateef97

I have attempted to follow the examples here to a T, but I'm still unable to generate the swagger.json file.
This is how my configuration looks like
// Config

const version = process.env.VERSION;
const swaggerDefinition = {
  openapi: '3.0.1',
  info: {
    title: 'Demo server',
    version,
    description: 'Fida',
  },
  servers: [
    {
      url: '/api/v1',
      description: 'Host system path',
    },
  ],
  definition: {},
  paths: {},
};

// options for the swagger docs
const options = (fileName) => ({
  // import swaggerDefinitions
  swaggerDefinition,
  // path to the API docs
  apis: [fileName],
});

export default options;

src/main.ts file

  private readonly app: Express;
    constructor() {
       this.app = express();
       
       this.config();
       this.routes()
   }

    private config(): void {
    if (process.env.NODE_ENV === 'dev') {

      this.app.use(getResponseExpress(this.app, options(__filename), './src/swagger.json'));
    }
  }

When I make my requests, the swagget.json file isn't updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions