Skip to content

Commit

Permalink
Merge 6ca019f into 22dc1b4
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Sep 5, 2021
2 parents 22dc1b4 + 6ca019f commit 4419bb1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ const server = app.listen(serverPort, () => {});
const Koa = require('koa');
const Router = require('koa-router');
const bodyParser = require('koa-bodyparser');
const inputValidation = require('../../src/middleware');
const inputValidation = require('openapi-validator-middleware');
let app = new Koa();
let router = new Router();
app.use(bodyParser());
app.use(router.routes());
module.exports = inputValidation.init('test/pet-store-swagger.yaml', {framework: 'koa'});
module.exports = inputValidation.init('test/pet-store-swagger.yaml', { framework: 'koa' });
router.get('/pets', inputValidation.validate, async (ctx, next) => {
ctx.status = 200;
ctx.body = { result: 'OK' };
Expand All @@ -178,7 +178,7 @@ return app;
```js
'use strict';
const fastify = require('fastify');
const inputValidation = require('../../src/middleware');
const inputValidation = require('openapi-validator-middleware');

async function getApp() {
inputValidation.init('test/pet-store-swagger.yaml', {
Expand Down Expand Up @@ -209,7 +209,7 @@ async function getApp() {

### multiple-instances
```js
const inputValidation = require('../../src/middleware');
const inputValidation = require('openapi-validator-middleware');
const validatorA = inputValidation.getNewMiddleware('test/pet-store-swaggerA.yaml', {framework: 'express'});
const validatorB = inputValidation.getNewMiddleware('test/pet-store-swaggerB.yaml', {framework: 'express'});

Expand All @@ -234,12 +234,12 @@ Multipart/form-data (files) support is based on [`express/multer`](https://githu

### Fastify support

Fastify support requires `uri-js` dependency to be available.
When using this package as middleware for fastify, the validations errors are being thrown.
Fastify support requires `uri-js` dependency to be installed. Make sure to run `npm install uri-js`.
When using this package as a middleware for fastify, the validations errors will be thrown.

### Koa support

When using this package as middleware for koa, the validations errors are being thrown.
When using this package as middleware for koa, the validations errors will be thrown.

### Koa packages

Expand Down

0 comments on commit 4419bb1

Please sign in to comment.