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