Surnet / swagger-jsdoc

Generates swagger/openapi specification based on jsDoc comments and YAML files.
MIT License
1.69k stars 228 forks source link

Separate annotation to different files #335

Closed Tamir198 closed 1 year ago

Tamir198 commented 1 year ago

Given this example from the docs:

/**
 * @openapi
 * /:
 *   get:
 *     description: Welcome to swagger-jsdoc!
 *     responses:
 *       200:
 *         description: Returns a mysterious string.
 */
app.get('/', (req, res) => {
  res.send('Hello World!');
});

Is it possible to separate all the annotations into a different file? I have checked the docs and issues opened but could not find anything.

AM i missing someplace in the documentation talking about this?

By the way I am using swagger-jsdoc version 6.2.5

Tamir198 commented 1 year ago

Ok all you need to do is to create new js file and put your annotations there.