Gathering detailed insights and metrics for egg-swagger-decorator-plus
Gathering detailed insights and metrics for egg-swagger-decorator-plus
Gathering detailed insights and metrics for egg-swagger-decorator-plus
Gathering detailed insights and metrics for egg-swagger-decorator-plus
using decorator to automatically generate swagger doc for koa-router
npm install egg-swagger-decorator-plus
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
352 Stars
28 Commits
83 Forks
8 Watchers
4 Branches
3 Contributors
Updated on Jun 28, 2025
Latest Version
0.1.2
Package Id
egg-swagger-decorator-plus@0.1.2
Unpacked Size
49.21 kB
Size
14.06 kB
File Count
24
NPM Version
6.10.2
Node Version
12.8.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
using decorator to auto generate swagger json docs
1npm install egg-swagger-decorator
using decorator to auto generate swagger json docs
based on Swagger OpenAPI Specification 2.0
// using commonds below to start and test the example server
git clone https://github.com/Cody2333/egg-swagger-decorator.git
cd egg-swagger-decorator
npm install
npm run dev
finally open:
http://localhost:7001/swagger-html
// router.js
import { Application } from 'egg';
import { wrapper } from '../lib';
export default (app: Application) => {
wrapper(app, {
// // [optional] default is /swagger-html
// swaggerHtmlEndpoint: '/sw',
// // [optional] default is /swagger-json
// swaggerJsonEndpoint: '/sj',
// // [optional] default is false. if true, will call makeSwaggerRouter(app) automatically
// makeswaggerRouter: false,
title: 'foo',
version: 'v1.0.0',
description: 'bar',
});
makeSwaggerRouter(app);
};
// controller/test.ts
import { Controller } from 'egg';
import { request, summary, query, path, body, tags } from 'egg-swagger-decorator';
const testTag = tags(['test']);
const userSchema = {
name: { type: 'string', required: true },
gender: { type: 'string', required: false, example: 'male' },
groups: {
type: 'array',
required: true,
items: { type: 'string', example: 'group1' }
}
};
export default class Test extends Controller{
@request('get', '/users')
@summary('get user list')
@testTag
@query({
type: { type: 'number', required: true, default: 1, description: 'type' }
})
public async getUsers() {
const { ctx } = this;
const users = [{user1: {name: 'xxx'}}]
ctx.body = { users };
}
@request('get', '/users/{id}')
@summary('get user info by id')
@testTag
@path({
id: { type: 'number', required: true, default: 1, description: 'id' }
})
public async getUser() {
const { id } = this.ctx.params;
const user = {user1: {id, name: 'xxx'}}
this.ctx.body = { user };
}
@request('post', '/users')
@testTag
@body(userSchema)
public async postUser() {
const body = this.ctx.request.body;
this.ctx.body = { result: body };
}
public async temp(ctx) {
ctx.body = { result: 'success' };
}
}
request // @request('POST', '/users')
tags // @tags(['example'])
query // @query({limit: {type: 'number', required: true, default: 10, description: 'desc'}})
path // @path({limit: {type: 'number', required: true, default: 10, description: 'desc'}})
body // @body({groups: {type: 'array', required: true, items: { type: 'string', example: 'group1' }}})
formData // @formData({file: {type: 'file', required: true, description: 'file content'}})
middlewares
// support koa middlewares.
// eg. @middlewares([func1,func2])
summary // @summary('api summary')
description // @description('api description')
responses
// @responses({ 200: { description: 'success'}, 400: { description: 'error'}})
// responses is optional
© MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 2/26 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-14
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