Skip to content

Commit d70a031

Browse files
authored
docs: fix import examples (#170)
* Fix import in documentation * Additional documentation fixes
1 parent 22dc1b4 commit d70a031

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ const server = app.listen(serverPort, () => {});
148148
const Koa = require('koa');
149149
const Router = require('koa-router');
150150
const bodyParser = require('koa-bodyparser');
151-
const inputValidation = require('../../src/middleware');
151+
const inputValidation = require('openapi-validator-middleware');
152152
let app = new Koa();
153153
let router = new Router();
154154
app.use(bodyParser());
155155
app.use(router.routes());
156-
module.exports = inputValidation.init('test/pet-store-swagger.yaml', {framework: 'koa'});
156+
module.exports = inputValidation.init('test/pet-store-swagger.yaml', { framework: 'koa' });
157157
router.get('/pets', inputValidation.validate, async (ctx, next) => {
158158
ctx.status = 200;
159159
ctx.body = { result: 'OK' };
@@ -178,7 +178,7 @@ return app;
178178
```js
179179
'use strict';
180180
const fastify = require('fastify');
181-
const inputValidation = require('../../src/middleware');
181+
const inputValidation = require('openapi-validator-middleware');
182182

183183
async function getApp() {
184184
inputValidation.init('test/pet-store-swagger.yaml', {
@@ -209,7 +209,7 @@ async function getApp() {
209209

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

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

235235
### Fastify support
236236

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

240240
### Koa support
241241

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

244244
### Koa packages
245245

0 commit comments

Comments
 (0)