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.2.32-beta to 0.3.33-beta

dist/errors/index.d.ts

4

example/app.js

@@ -7,3 +7,3 @@ var express = require('express');

var http = require('http');
var OpenApiMiddleware = require('express-middleware-openapi').OpenApiMiddleware;
var OpenApiValidator = require('express-openapi-validator').OpenApiValidator;
var app = express();

@@ -18,3 +18,3 @@

new OpenApiMiddleware({
new OpenApiValidator({
apiSpecPath: '../openapi.yaml',

@@ -21,0 +21,0 @@ }).install(app);

{
"name": "express-openapi-validator",
"version": "0.2.32-beta",
"version": "0.3.33-beta",
"description": "",

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

# express-openapi-validator
![](https://travis-ci.com/cdimascio/express-middleware-openapi.svg?branch=master) ![](https://img.shields.io/npm/v/express-middleware-openapi.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)
![](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)
ExpressJs middleware 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,

@@ -10,3 +10,3 @@ ## Install

```shell
npm i express-middleware-openapi
npm i express-openapi-validator
```

@@ -16,6 +16,6 @@

Register openapi validation middleware
Install the openapi validator
```javascript
new OpenApiMiddleware({
new OpenApiValidator({
apiSpecPath: './openapi.yaml',

@@ -49,3 +49,3 @@ }).install(app);

var http = require('http');
var OpenApiMiddleware = require('express-middleware-openapi').OpenApiMiddleware;
var OpenApiValidator = require('express-openapi-validator').OpenApiValidator;
var app = express();

@@ -60,3 +60,3 @@

new OpenApiMiddleware({
new OpenApiValidator({
apiSpecPath: './openapi.yaml',

@@ -63,0 +63,0 @@ }).install(app);

@@ -10,7 +10,7 @@ import * as _ from 'lodash';

export interface OpenApiMiddlewareOpts {
export interface OpenApiValidatorOpts {
apiSpecPath: string;
}
export function OpenApiMiddleware(options: OpenApiMiddlewareOpts) {
export function OpenApiValidator(options: OpenApiValidatorOpts) {
if (!options.apiSpecPath) throw ono('apiSpecPath required');

@@ -28,3 +28,3 @@

OpenApiMiddleware.prototype.install = function(app: ExpressApp) {
OpenApiValidator.prototype.install = function(app: ExpressApp) {
const pathParams = [];

@@ -31,0 +31,0 @@ for (const route of this.context.routes) {

@@ -7,3 +7,3 @@ var express = require('express');

const { OpenApiMiddleware } = require('../src');
const { OpenApiValidator } = require('../src');
const { startServer, routes } = require('./app.common');

@@ -20,3 +20,3 @@

new OpenApiMiddleware({
new OpenApiValidator({
apiSpecPath: './openapi.yaml',

@@ -23,0 +23,0 @@ }).install(app);

const expect = require('chai').expect;
const { OpenApiMiddleware } = require('../src');
const { OpenApiValidator } = require('../src');
const packageJson = require('../package.json');

@@ -7,3 +7,3 @@

it('should succeed when spec exists and is valid', async () => {
const oam = new OpenApiMiddleware({
const oam = new OpenApiValidator({
apiSpecPath: './openapi.yaml',

@@ -20,3 +20,3 @@ enableObjectCoercion: true, // should be default

const createMiddleware = () =>
new OpenApiMiddleware({
new OpenApiValidator({
apiSpecPath: './not-found.yaml',

@@ -23,0 +23,0 @@ enableObjectCoercion: true, // should be default

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