Gathering detailed insights and metrics for koa-swagger-ui
Gathering detailed insights and metrics for koa-swagger-ui
npm install koa-swagger-ui
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
7,274
Last Day
2
Last Week
19
Last Month
135
Last Year
531
1 Stars
32 Commits
1 Forks
2 Watching
6 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
1.1.3
Package Id
koa-swagger-ui@1.1.3
Unpacked Size
19.25 kB
Size
7.32 kB
File Count
10
NPM Version
6.13.1
Node Version
13.2.0
Cumulative downloads
Total Downloads
Last day
-77.8%
2
Compared to previous day
Last week
-62.7%
19
Compared to previous week
Last month
200%
135
Compared to previous month
Last year
28.9%
531
Compared to previous year
Still missing:
A node module for generating Swagger 2.0 JSON definitions from existing koa-joi-router routes.
1 2const SwaggerAPI = require('joi-router-swagger-docs').SwaggerAPI; 3const Router = require('koa-joi-router'); 4const Joi = Router.Joi; 5const router = router(); 6 7router.get('/demo',{ 8 validate: { 9 query: { 10 name: joi.string().max(100).description('new user name') 11 } 12 }, 13 handler: async (ctx) => { 14 ctx.status = 200; 15 ctx.body = {status: 1, msg: 'hello world'}; 16 }, 17 swagger: { 18 tags: ['demo'], 19 responses: { 20 200: { 21 description: '查询域名', 22 schema: joi.object({ 23 status: joi.number().integer().default(1), 24 server: joi.string().default('js.cool') 25 }).label('serverSuccess') 26 } 27 } 28 } 29 }); 30 31router.get('/signup', { 32 validate: { 33 type: 'json', 34 body: { 35 name: Joi.string().max(100).description('new user name') 36 }, 37 output: { 38 200: { 39 body: { 40 userId: Joi.string().description('newly created user id') 41 } 42 } 43 } 44 }, 45 handler: function*() { 46 // ... 47 } 48}); 49 50router.get('/about/:versionId', { 51 swagger: { 52 description: 'Anything in swagger is passed directly onto the swagger object for that path', 53 parameters: [ 54 {name: 'versionId', in: 'path', description: 'this is a good way to get other items onto swagger object.'} 55 ] 56 }, 57 handler: function*() { 58 // ... 59 } 60}) 61 62//if you use swagger-ui you will want path parameters so people can use the 'try it out' functionality, despite the fact that koa-joi-router doesn't support them 63router.get('/user/:id/friends/:friendId', { 64 validate: { 65 path: Joi.object().keys({ 66 id: Joi.string().alphanum().max(24).description('id of user').required(), 67 friendId: Joi.string().alphanum().max(24).description('id of user\'s friend'), 68 }) 69 output: { 70 200: { 71 body: { 72 userId: Joi.string().description('The friend of the user. they are pretty cool.') 73 } 74 } 75 } 76 }, 77 handler: function*() { 78 // ... 79 } 80}); 81 82swaggerAPI = new SwaggerAPI(); 83swaggerAPI.addJoiRouter(router); 84 85let spec = swaggerAPI.generateSpec({ 86 info: { 87 title: 'Example API', 88 description: 'API for creating and editing examples', 89 version: '1.1' 90 }, 91 basePath: '/api/v1' 92}); 93 94console.log(JSON.stringify(spec, null, ' '));
Creates a new SwaggerAPI instance.
Add a joi-router instance to the API. The router should already have all its
routes set up before calling this method (which pulls the route definitions
from the router's .routes
property).
Options:
Create a Swagger specification for this API. A base specification should be
provided with an info
object (containing at least the title
and version
strings) and any other global descriptions.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/20 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
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-20
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