Gathering detailed insights and metrics for swagger-ui-koa
Gathering detailed insights and metrics for swagger-ui-koa
npm install swagger-ui-koa
Typescript
Module System
Min. Node Version
Node Version
NPM Version
78.7
Supply Chain
99.1
Quality
74.8
Maintenance
100
Vulnerability
100
License
HTML (75.49%)
JavaScript (24.51%)
Total Downloads
271,644
Last Day
233
Last Week
742
Last Month
3,477
Last Year
61,498
8 Stars
1 Commits
5 Forks
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.0.1
Package Id
swagger-ui-koa@0.0.1
Size
475.30 kB
NPM Version
4.2.0
Node Version
7.8.0
Cumulative downloads
Total Downloads
Last day
9.9%
233
Compared to previous day
Last week
-32.6%
742
Compared to previous week
Last month
0.5%
3,477
Compared to previous month
Last year
-28.1%
61,498
Compared to previous year
1
Forked from swagger-ui-express
Adds middleware to your koa app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
Updated to Swagger 3.0.17
In app's package.json
"swagger-ui-koa": "latest" // or desired version
Setup swagger-app-wrapper.js
1import swaggerUi from 'swagger-ui-koa'; 2import swaggerJSDoc from 'swagger-jsdoc'; 3import convert from 'koa-convert'; 4import mount from 'koa-mount'; 5//import swaggerDocument from './swagger.json'; //also can be used 6 7export default function (app) { 8 //without jsdoc from swagger.json 9 //app.use(swaggerUi.serve); //serve swagger static files 10 //app.use(convert(mount('/swagger', swaggerUi.setup(swaggerDocument)))); //mount endpoint for access 11 12 //with jsdoc 13 const options = { 14 swaggerDefinition: { 15 info: { 16 title: 'API', // Title (required) 17 version: '2.0.0', // Version (required) 18 }, 19 }, 20 apis: [ 21 './src/module/swagger/swagger.yaml', 22 './src/routes/*.js', // Path to the API docs from root 23 './src/module/swagger/parameters.yaml' 24 ], 25 }; 26 // Initialize swagger-jsdoc -> returns validated swagger spec in json format 27 const swaggerSpec = swaggerJSDoc(options); 28 app.use(swaggerUi.serve); //serve swagger static files 29 app.use(convert(mount('/swagger', swaggerUi.setup(swaggerSpec)))); //mount endpoint for access 30} 31
Open http://<app_host>
:<app_port>
/swagger in your browser to view the documentation.
By default the Swagger Explorer bar is hidden, to display it pass true as the second parameter to the setup function:
1const express = require('express'); 2const app = express(); 3const swaggerUi = require('swagger-ui-express'); 4const swaggerDocument = require('./swagger.json'); 5 6var showExplorer = true; 7 ... 8 swaggerUi.setup(swaggerDocument, showExplorer) 9 ...
To pass custom options e.g. validatorUrl, to the SwaggerUi client pass an object as the third parameter:
1 2var showExplorer = true; 3var options = { 4 validatorUrl : null 5}; 6... 7swaggerUi.setup(swaggerDocument, showExplorer, options)); 8...
To customize the style of the swagger page, you can pass custom CSS as the fourth parameter.
E.g. to hide the swagger header:
1var showExplorer = false; 2var options = {}; 3var customCss = '#header { display: none }'; 4 5... 6swaggerUi.setup(swaggerDocument, showExplorer, options, customCss)); 7...
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/1 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
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