Installations
npm install express-jsdoc-swagger-extended
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 10.0.0
Node Version
15.9.0
NPM Version
7.5.6
Score
69
Supply Chain
95.3
Quality
72
Maintenance
100
Vulnerability
98.2
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
3,031
Last Day
1
Last Week
4
Last Month
24
Last Year
484
GitHub Statistics
MIT License
2 Stars
245 Commits
2 Watchers
4 Branches
1 Contributors
Updated on Aug 24, 2024
Package Meta Information
Latest Version
1.3.5
Package Id
express-jsdoc-swagger-extended@1.3.5
Unpacked Size
63.68 kB
Size
20.58 kB
File Count
64
NPM Version
7.5.6
Node Version
15.9.0
Total Downloads
Cumulative downloads
Total Downloads
3,031
Last Day
0%
1
Compared to previous day
Last Week
300%
4
Compared to previous week
Last Month
71.4%
24
Compared to previous month
Last Year
28.4%
484
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
express-jsdoc-swagger
With this library, you can document your express endpoints using swagger OpenAPI 3 Specification without writing YAML or JSON. You can write jsdoc comments on each endpoint, and the library is going to create the swagger UI.
Prerequisites
This library assumes you are using:
Installation
npm i express-jsdoc-swagger
Usage
1const express = require('express'); 2const expressJSDocSwagger = require('express-jsdoc-swagger'); 3 4const options = { 5 info: { 6 version: '1.0.0', 7 title: 'Albums store', 8 license: { 9 name: 'MIT', 10 }, 11 }, 12 security: { 13 BasicAuth: { 14 type: 'http', 15 scheme: 'basic', 16 }, 17 }, 18 filesPattern: './**/*.js', // Glob pattern to find your jsdoc files (it supports arrays too ['./**/*.controller.js', './**/*.route.js']) 19 swaggerUIPath: '/your-url', // SwaggerUI will be render in this url. Default: '/api-docs' 20 baseDir: __dirname, 21 exposeSwaggerUI: true, // Expose OpenAPI UI. Default true 22 exposeApiDocs: false, // Expose Open API JSON Docs documentation in `apiDocsPath` path. Default false. 23 apiDocsPath: '/v3/api-docs', // Open API JSON Docs endpoint. Default value '/v3/api-docs'. 24}; 25 26const app = express(); 27const PORT = 3000; 28 29expressJSDocSwagger(app)(options); 30 31/** 32 * GET /api/v1 33 * @summary This is the summary or description of the endpoint 34 * @return {object} 200 - success response 35 */ 36app.get('/api/v1', (req, res) => res.json({ 37 success: true, 38})); 39 40app.listen(PORT, () => console.log(`Example app listening at http://localhost:${PORT}`)); 41
Examples
- Basic configuration
1const options = { 2 info: { 3 version: '1.0.0', 4 title: 'Albums store', 5 license: { 6 name: 'MIT', 7 }, 8 }, 9 security: { 10 BasicAuth: { 11 type: 'http', 12 scheme: 'basic', 13 }, 14 }, 15 filesPattern: './**/*.js', // Glob pattern to find your jsdoc files 16 baseDir: __dirname, 17};
- Components definition
1/** 2 * A song type 3 * @typedef {object} Song 4 * @property {string} title.required - The title 5 * @property {string} artist - The artist 6 * @property {number} year - The year - double 7 */
- Endpoint that returns a
Songs
model array
1/** 2 * GET /api/v1/albums 3 * @summary This is the summary or description of the endpoint 4 * @tags album 5 * @return {array<Song>} 200 - success response - application/json 6 */ 7app.get('/api/v1/albums', (req, res) => ( 8 res.json([{ 9 title: 'abum 1', 10 }]) 11));
- Basic endpoint definition with tags, params and basic authentication
1/** 2 * GET /api/v1/album 3 * @summary This is the summary or description of the endpoint 4 * @security BasicAuth 5 * @tags album 6 * @param {string} name.query.required - name param description 7 * @return {object} 200 - success response - application/json 8 * @return {object} 400 - Bad request response 9 */ 10app.get('/api/v1/album', (req, res) => ( 11 res.json({ 12 title: 'abum 1', 13 }) 14));
- Basic endpoint definition with code example for response body
1/** 2 * GET /api/v1/albums 3 * @summary This is the summary or description of the endpoint 4 * @tags album 5 * @return {array<Song>} 200 - success response - application/json 6 * @example response - 200 - success response example 7 * [ 8 * { 9 * "title": "Bury the light", 10 * "artist": "Casey Edwards ft. Victor Borba", 11 * "year": 2020 12 * } 13 * ] 14 */ 15app.get('/api/v1/albums', (req, res) => ( 16 res.json([{ 17 title: 'track 1', 18 }]) 19));
You can find more examples here, or visit our documentation.
Contributors ✨
Briam Martinez Escobar 💻 | Kevin Julián MartÃnez Escobar 💻 | Heung-yeon Oh 💻 | Sara Hernández 💻 | Josep Servat 💻 | Nick Dong 💻 | Aleksander Stós 💻 |
Kjell Dankert 💻 | juliendu11 💻 | Mohamed Meabed 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!

No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/npm-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/npm-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/runTests.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/runTests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/runTests.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/runTests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/runTests.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/runTests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/runTests.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/runTests.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/runTests.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/meabed/express-jsdoc-swagger-extended/runTests.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 2 out of 2 npmCommand dependencies pinned
Reason
Found 0/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1
- Warn: no topLevel permission defined: .github/workflows/runTests.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Reason
18 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2.8
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More