Installations
npm install swagger-jsdoc-express
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.21.0
NPM Version
6.14.4
Score
55.6
Supply Chain
94.1
Quality
72.8
Maintenance
100
Vulnerability
79.9
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (100%)
Developer
Download Statistics
Total Downloads
16,240
Last Day
2
Last Week
4
Last Month
31
Last Year
3,496
GitHub Statistics
7 Stars
36 Commits
4 Watching
2 Branches
3 Contributors
Package Meta Information
Latest Version
4.1.0
Package Id
swagger-jsdoc-express@4.1.0
Unpacked Size
43.07 kB
Size
10.45 kB
File Count
12
NPM Version
6.14.4
Node Version
10.21.0
Total Downloads
Cumulative downloads
Total Downloads
16,240
Last day
0%
2
Compared to previous day
Last week
-66.7%
4
Compared to previous week
Last month
-75%
31
Compared to previous month
Last year
146.2%
3,496
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
swagger-jsdoc-express
Sets up one or more Swagger documentation UIs via Express using JSDoc from source files.
Install
Execute the following command from your project folder, where your package.json
file is stored:
1npm install --save swagger-jsdoc-express
Example
Setup UI
1import * as express from 'express'; 2import * as swaggerJSDocExpress from 'swagger-jsdoc-express'; 3 4const app = express(); 5 6// create a '/swagger' endpoint ... 7swaggerJSDocExpress.setupSwaggerUIFromSourceFiles( 8 { 9 cwd: '/root/path/to/source/files', 10 files: [ '**/*.ts', '**/*.js' ], 11 }, 12 13 // ... and directly register it 14 // in 'app' 15 app 16); 17 18app.listen(8080, () => { 19 // should be available via 20 // http://localhost:8080/swagger 21 // now 22});
Document API
The following code shows, how to document API (you can put the JSDoc to all locations inside the files, which are handled by setupSwaggerUIFromSourceFiles()
function):
1/** 2 * @swaggerDefinition 3 * 4 * MonitoringStatusResult: 5 * type: object 6 * properties: 7 * data: 8 * type: object 9 * description: The monitoring data (if operation was successful). 10 * properties: 11 * cpu_load: 12 * type: number 13 * description: The CPU load in percentage. 14 * example: 0.05 15 * database_connected: 16 * type: boolean 17 * description: Indicates if app could connect to database or not. 18 * example: true 19 * disk_space: 20 * type: number 21 * description: 'The total disc space, in bytes.' 22 * example: 509197923979 23 * disk_space_used: 24 * type: number 25 * description: 'The disc space in use, in bytes.' 26 * example: 23979 27 * ram: 28 * type: number 29 * description: 'The total ram, in bytes.' 30 * example: 5091979000 31 * ram_used: 32 * type: number 33 * description: 'The ram in use, in bytes.' 34 * example: 23979 35 * version: 36 * type: object 37 * description: The app version. 38 * properties: 39 * date: 40 * type: string 41 * description: The last commit date. 42 * example: '1979-09-05T23:09:19.790Z' 43 * hash: 44 * type: string 45 * description: The last commit hash. 46 * example: 0123456789012345678901234567890123456789 47 * success: 48 * type: boolean 49 * description: Indicates if operation was successful or not. 50 * example: true 51 */ 52interface MonitoringStatusResult { 53 // ... 54} 55 56 57/** 58 * @swaggerPath 59 * 60 * /monitoring/status: 61 * get: 62 * summary: Returns monitoring data. 63 * produces: 64 * - application/json 65 * responses: 66 * '200': 67 * description: Operation was successful. 68 * schema: 69 * $ref: '#/definitions/MonitoringStatusResult' 70 * '500': 71 * description: Server error 72 */ 73app.get('/monitoring/status', (request, response) => { 74 return response.status(200) 75 .send(JSON.stringify(<MonitoringStatusResult>{ 76 // ... 77 })); 78});
Instead of using YAML, you are also able to use JSON format.
Contributors
Documentation
The complete API documentation can be found here.
Resources
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: GNU Lesser General Public License v3.0: LICENSE:0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/publish.yml:1
- Info: no jobLevel write permissions found
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
Found 1/27 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/egodigital/swagger-jsdoc-express/publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/egodigital/swagger-jsdoc-express/publish.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:17
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
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 4 are checked with a SAST tool
Reason
29 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- 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-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-6c9x-mj3g-h47x
- Warn: Project is vulnerable to: GHSA-qrmm-w75w-3wpx
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
Score
2.5
/10
Last Scanned on 2024-12-16
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