1.1.0 • Published 5 years ago

koa-swagger-validator v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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

VariableTypeRequired
specobjectyes
optionsobjectno

spec

Swagger RESTful API Documentation Specification

options

PropertiesTypeRequired
securityobjectno
validatorobjectno
routerobjectno
uiobjectno

See also swagger-tools full documentation.

Limitations

  • Koa 2
  • Swagger 2

Credits

License

MIT