Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate the swagger.json file #31

Open
abdullateef97 opened this issue Aug 11, 2024 · 0 comments
Open

Unable to generate the swagger.json file #31

abdullateef97 opened this issue Aug 11, 2024 · 0 comments

Comments

@abdullateef97
Copy link

abdullateef97 commented Aug 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant