1.1.0 • Published 5 years ago
koa-swagger-validator v1.1.0
koa-swagger-validator
Koa 2 + Swagger 2 + Swagger-tools
Install
$ npm install koa-swagger-validator --save
or
$ yarn add koa-swagger-validator
Usage
validator(spec) => koa2 middleware
import validator from "koa-swagger-validator";
import spec from "./swagger.json";
(async () => {
const app = new Koa();
app.use(await validator(spec));
})();
validator(spec, options) => koa2 middleware
import validator from "koa-swagger-validator";
import spec from "./swagger.json";
(async () => {
const app = new Koa();
app.use(await validator(spec, { /* ... */ }));
})();
Documentation
Variable | Type | Required |
---|---|---|
spec | object | yes |
options | object | no |
spec
Swagger RESTful API Documentation Specification
options
Properties | Type | Required |
---|---|---|
security | object | no |
validator | object | no |
router | object | no |
ui | object | no |
See also swagger-tools full documentation.
Limitations
- Koa 2
- Swagger 2