cript app.use( OpenApiValidator.middleware({ apiSpec: './openapi.yaml', validateRequests: true, // (default) validateResponses: true, // false by default }), ); ``` 3. Register an error handler ```javascript app.use((err, req, res, next) => { // format error res.status(err.status || 500).json({ message: err.message, errors: err.errors, }); }); ``` _**Important:** Ensure express is configured with all relevant body parsers. Body parser middleware functions must be specified prior to any validated routes. See an [example](#example-express-api-server)_. ## [Documentation](https://cdimascio.github.io/express-openapi-validator-documentation/) See the [doc](https://cdimascio.github.io/express-openapi-validator-documentation/) for complete documenation _deprecated_ [legacy doc](https://github.com/cdimascio/express-openapi-validator/wiki) ## License [MIT](LICENSE) Buy Me A Coffee