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 5.1.6 to 5.2.0

dist/framework/ajv/formats.js.map

1

dist/framework/ajv/formats.js

@@ -38,1 +38,2 @@ "use strict";

};
//# sourceMappingURL=formats.js.map

@@ -209,1 +209,2 @@ "use strict";

}
//# sourceMappingURL=index.js.map

@@ -59,1 +59,2 @@ "use strict";

exports.AjvOptions = AjvOptions;
//# sourceMappingURL=options.js.map

@@ -113,1 +113,2 @@ "use strict";

}
//# sourceMappingURL=base.path.js.map

@@ -27,1 +27,2 @@ "use strict";

];
//# sourceMappingURL=base.serdes.js.map

@@ -94,1 +94,2 @@ "use strict";

exports.OpenAPIFramework = OpenAPIFramework;
//# sourceMappingURL=index.js.map

@@ -188,1 +188,2 @@ /* istanbul ignore file */

exports.default = mung;
//# sourceMappingURL=modded.express.mung.js.map

@@ -68,1 +68,2 @@ "use strict";

exports.OpenApiContext = OpenApiContext;
//# sourceMappingURL=openapi.context.js.map

@@ -43,1 +43,2 @@ "use strict";

exports.OpenAPISchemaValidator = OpenAPISchemaValidator;
//# sourceMappingURL=openapi.schema.validator.js.map

@@ -89,1 +89,2 @@ "use strict";

exports.OpenApiSpecLoader = OpenApiSpecLoader;
//# sourceMappingURL=openapi.spec.loader.js.map
import * as ajv from 'ajv';
import * as multer from 'multer';
import { FormatsPluginOptions } from 'ajv-formats';
import { Request, Response, NextFunction } from 'express';
import { Request, Response, NextFunction, RequestHandler } from 'express';
import { RouteMetadata } from './openapi.spec.loader';
export { OpenAPIFrameworkArgs };

@@ -48,3 +49,3 @@ export declare type BodySchema = OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | {};

basePath: string;
resolver: Function;
resolver: (handlersPath: string, route: RouteMetadata, apiDoc: OpenAPIV3.Document) => RequestHandler | Promise<RequestHandler>;
};

@@ -76,4 +77,13 @@ export declare type Format = {

};
declare type Primitive = undefined | null | boolean | string | number | Function;
declare type DeepImmutable<T> = T extends Primitive ? T : T extends Array<infer U> ? DeepImmutableArray<U> : T extends Map<infer K, infer V> ? DeepImmutableMap<K, V> : DeepImmutableObject<T>;
interface DeepImmutableArray<T> extends ReadonlyArray<DeepImmutable<T>> {
}
interface DeepImmutableMap<K, V> extends ReadonlyMap<DeepImmutable<K>, DeepImmutable<V>> {
}
declare type DeepImmutableObject<T> = {
readonly [K in keyof T]: DeepImmutable<T[K]>;
};
export interface OpenApiValidatorOpts {
apiSpec: OpenAPIV3.Document | string;
apiSpec: DeepImmutable<OpenAPIV3.Document> | string;
validateApiSpec?: boolean;

@@ -80,0 +90,0 @@ validateResponses?: boolean | ValidateResponseOpts;

@@ -163,1 +163,2 @@ "use strict";

exports.Forbidden = Forbidden;
//# sourceMappingURL=types.js.map

@@ -33,1 +33,2 @@ "use strict";

}
//# sourceMappingURL=index.js.map

@@ -14,1 +14,2 @@ "use strict";

Object.defineProperty(exports, "security", { enumerable: true, get: function () { return openapi_security_1.security; } });
//# sourceMappingURL=index.js.map

@@ -103,1 +103,2 @@ "use strict";

exports.applyOpenApiMetadata = applyOpenApiMetadata;
//# sourceMappingURL=openapi.metadata.js.map

@@ -139,1 +139,2 @@ "use strict";

}
//# sourceMappingURL=openapi.multipart.js.map

@@ -21,3 +21,7 @@ "use strict";

options.allowUnknownQueryParameters;
this.ajv = (0, ajv_1.createRequestAjv)(apiDoc, Object.assign(Object.assign({}, options), { coerceTypes: true }));
this.ajv = (0, ajv_1.createRequestAjv)(apiDoc,
// This should always be true as it handles query params (everything, but the body)
// This should always be coerced. Note that coerceTypes = 'array` also operates as true
// but also coerces 'array' types
!options.coerceTypes ? Object.assign(Object.assign({}, options), { coerceTypes: true }) : options);
this.ajvBody = (0, ajv_1.createRequestAjv)(apiDoc, options);

@@ -129,2 +133,5 @@ }

multipartNested(req, schemaBody) {
if (!req.body) {
return;
}
Object.keys(req.body).forEach((key) => {

@@ -265,1 +272,2 @@ var _a, _b, _c, _d;

}
//# sourceMappingURL=openapi.request.validator.js.map

@@ -256,1 +256,2 @@ "use strict";

exports.ResponseValidator = ResponseValidator;
//# sourceMappingURL=openapi.response.validator.js.map

@@ -237,1 +237,2 @@ "use strict";

}
//# sourceMappingURL=openapi.security.js.map

@@ -73,1 +73,2 @@ "use strict";

exports.BodySchemaParser = BodySchemaParser;
//# sourceMappingURL=body.parse.js.map

@@ -286,1 +286,2 @@ "use strict";

exports.RequestParameterMutator = RequestParameterMutator;
//# sourceMappingURL=req.parameter.mutator.js.map

@@ -74,1 +74,2 @@ "use strict";

exports.ParametersSchemaParser = ParametersSchemaParser;
//# sourceMappingURL=schema.parse.js.map

@@ -509,1 +509,2 @@ "use strict";

exports.SchemaPreprocessor = SchemaPreprocessor;
//# sourceMappingURL=schema.preprocessor.js.map

@@ -86,1 +86,2 @@ "use strict";

}
//# sourceMappingURL=util.js.map

@@ -160,1 +160,2 @@ "use strict";

exports.zipObject = zipObject;
//# sourceMappingURL=util.js.map

2

dist/openapi.validator.d.ts

@@ -18,3 +18,3 @@ import { Application, Router } from 'express';

private responseValidationMiddleware;
installOperationHandlers(baseUrl: string, context: OpenApiContext): Router;
installOperationHandlers(baseUrl: string, context: OpenApiContext): Promise<Router>;
private validateOptions;

@@ -21,0 +21,0 @@ private normalizeOptions;

@@ -189,4 +189,4 @@ "use strict";

return pContext
.then(({ context }) => (router = self.installOperationHandlers(req.baseUrl, context)))
.then((router) => router(req, res, next))
.then(({ context }) => self.installOperationHandlers(req.baseUrl, context))
.then((installedRouter) => (router = installedRouter)(req, res, next))
.catch(next);

@@ -241,3 +241,3 @@ });

}
installOperationHandlers(baseUrl, context) {
async installOperationHandlers(baseUrl, context) {
const router = express.Router({ mergeParams: true });

@@ -258,3 +258,4 @@ this.installPathParams(router, context);

: expressRoute;
router[method.toLowerCase()](path, resolver(basePath, route, context.apiDoc));
const handler = await resolver(basePath, route, context.apiDoc);
router[method.toLowerCase()](path, handler);
}

@@ -354,1 +355,2 @@ }

exports.OpenApiValidator = OpenApiValidator;
//# sourceMappingURL=openapi.validator.js.map

@@ -48,1 +48,2 @@ "use strict";

exports.modulePathResolver = modulePathResolver;
//# sourceMappingURL=resolvers.js.map
{
"name": "express-openapi-validator",
"version": "5.1.6",
"version": "5.2.0",
"description": "Automatically validate API requests and responses with OpenAPI 3 and Express.",

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

"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.1.2",
"@types/multer": "^1.4.7",
"ajv": "^8.11.2",
"@apidevtools/json-schema-ref-parser": "^11.6.2",
"@types/multer": "^1.4.11",
"ajv": "^8.14.0",
"ajv-draft-04": "^1.0.0",

@@ -49,3 +49,3 @@ "ajv-formats": "^2.1.1",

"ono": "^7.1.3",
"path-to-regexp": "^6.2.0"
"path-to-regexp": "^6.2.2"
},

@@ -64,3 +64,3 @@ "devDependencies": {

"coveralls": "^3.1.1",
"express": "^4.17.3",
"express": "^4.19.2",
"mocha": "^9.2.2",

@@ -76,3 +76,6 @@ "morgan": "^1.10.0",

"typescript": "^4.6.2"
},
"peerDependencies": {
"express": "*"
}
}
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