Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-openapi-validator

Package Overview
Dependencies
Maintainers
1
Versions
281
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-openapi-validator - npm Package Compare versions

Comparing version 0.3.33-beta to 0.3.34

assets/express-openapi-validator-logo.png

7

example/app.js

@@ -53,9 +53,2 @@ var express = require('express');

// Register error handler!
app.use((err, req, res, next) => {
// format error
res.status(err.status).json({
errors: err.errors,
});
});

@@ -62,0 +55,0 @@ var server = http.createServer(app);

2

package.json
{
"name": "express-openapi-validator",
"version": "0.3.33-beta",
"version": "0.3.34",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# express-openapi-validator
![](https://travis-ci.com/cdimascio/express-openapi-validator.svg?branch=master) ![](https://img.shields.io/npm/v/express-openapi-validator.svg) [![Coverage Status](https://coveralls.io/repos/github/cdimascio/express-openapi-validator/badge.svg?branch=master)](https://coveralls.io/github/cdimascio/express-openapi-validator?branch=master) ![](https://img.shields.io/badge/license-MIT-blue.svg)
![](https://travis-ci.com/cdimascio/express-openapi-validator.svg?branch=master) ![](https://img.shields.io/npm/v/express-openapi-validator.svg) [![Coverage Status](https://coveralls.io/repos/github/cdimascio/express-middleware-openapi/badge.svg?branch=master)](https://coveralls.io/github/cdimascio/express-middleware-openapi?branch=master) ![](https://img.shields.io/badge/license-MIT-blue.svg)
An OpenApi validator for ExpressJS that automatically validates API requests using an OpenAPI 3.0 specification,
An OpenApi validator for ExpressJS that automatically validates API requests using an OpenAPI 3.0 specification.
<p align="center">
<img src="https://raw.githubusercontent.com/cdimascio/express-openapi-validator/master/assets/express-openapi-validator.png" width="500">
</p>
[express-openapi-validator](https://github.com/cdimascio/express-openapi-validator) is unopinionated and does not impose any coding convention or project structure. Simply, install the validator onto your express app, then define and implement routes the way you prefer. See an [example](#example-express-api-server).
## Install

@@ -34,6 +40,4 @@

(see complete [example](#example))
## Example Express API Server
## Example API Server
Try the complete example below:

@@ -89,5 +93,5 @@

## [Example API Server (Full Project Source)](https://github.com/cdimascio/express-middleware-openapi-example)
## [Example Express API Server](https://github.com/cdimascio/express-openapi-validator-example) (clone it)
A fully working example lives [here](https://github.com/cdimascio/express-middleware-openapi-example)
A fully working example lives [here](https://github.com/cdimascio/express-openapi-validator-example)

@@ -98,2 +102,4 @@ ## Example validation responses

`/pets/:id` should be of type integer, express-openapi-validator returns:
```shell

@@ -115,2 +121,4 @@ curl http://localhost:3000/v1/pets/as |jq

`/pets?limit=?` should be of type integer with a value greater than 5, express-openapi-validator returns:
```shell

@@ -138,2 +146,4 @@ curl http://localhost:3000/v1/pets?limit=1 |jq

`POST /pets` is defined to only accept media type application/json, express-openapi-validator returns:
```shell

@@ -157,2 +167,4 @@ curl --request POST \

`POST /pets` request body is required to contain the `name` properly, express-openapi-validator returns:
```shell

@@ -176,1 +188,5 @@ λ my-test curl --request POST \

#### ...and much more. Try it out!
## License
[MIT](LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc