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 4.12.7-alpha.1 to 4.12.7

1

dist/framework/index.js

@@ -26,2 +26,3 @@ "use strict";

validateApiSpec,
// extensions: this.apiDoc[`x-${args.name}-schema-extension`],
});

@@ -28,0 +29,0 @@ if (validateApiSpec) {

3

dist/framework/openapi.spec.loader.js

@@ -8,3 +8,3 @@ "use strict";

// Exported for tests
exports.sortRoutes = (r1, r2) => {
const sortRoutes = (r1, r2) => {
const e1 = r1.expressRoute.replace(/\/:/g, '/~');

@@ -14,2 +14,3 @@ const e2 = r2.expressRoute.replace(/\/:/g, '/~');

};
exports.sortRoutes = sortRoutes;
class OpenApiSpecLoader {

@@ -16,0 +17,0 @@ constructor(opts) {

@@ -72,12 +72,20 @@ "use strict";

const paramKeys = keys.map((k) => k.name);
const paramsVals = matchedRoute.slice(1).map(decodeURIComponent);
const pathParams = _zipObject(paramKeys, paramsVals);
const r = {
schema,
expressRoute,
openApiRoute,
pathParams,
};
r._responseSchema = _schema;
return r;
try {
const paramsVals = matchedRoute.slice(1).map(decodeURIComponent);
const pathParams = _zipObject(paramKeys, paramsVals);
const r = {
schema,
expressRoute,
openApiRoute,
pathParams,
};
r._responseSchema = _schema;
return r;
}
catch (error) {
throw new types_1.BadRequest({
path: req.path,
message: `malformed uri'`,
});
}
}

@@ -84,0 +92,0 @@ }

@@ -78,3 +78,4 @@ "use strict";

const mediaTypeSchema = mediaType === null || mediaType === void 0 ? void 0 : mediaType.schema;
const schema = (mediaTypeSchema === null || mediaTypeSchema === void 0 ? void 0 : mediaTypeSchema.$ref) ? Ajv.getSchema(mediaTypeSchema.$ref)
const schema = (mediaTypeSchema === null || mediaTypeSchema === void 0 ? void 0 : mediaTypeSchema.$ref)
? Ajv.getSchema(mediaTypeSchema.$ref)
: mediaTypeSchema;

@@ -81,0 +82,0 @@ const format = schema === null || schema === void 0 ? void 0 : schema.format;

@@ -47,3 +47,3 @@ "use strict";

path,
accepts,
accepts, // return 406 if not acceptable
});

@@ -84,3 +84,4 @@ }

// TODO public for test only - fix me
_validate({ validators, body, statusCode, path, accepts, }) {
_validate({ validators, body, statusCode, path, accepts, // optional
}) {
const status = statusCode !== null && statusCode !== void 0 ? statusCode : 'default';

@@ -141,3 +142,3 @@ const statusXX = status.toString()[0] + 'XX';

const message = this.ajvBody.errorsText(errors, {
dataVar: '',
dataVar: '', // responses
});

@@ -144,0 +145,0 @@ throw new types_1.InternalServerError({

@@ -82,3 +82,3 @@ "use strict";

*/
exports.findResponseContent = function (accepts, expectedTypes) {
const findResponseContent = function (accepts, expectedTypes) {
const expectedTypesSet = new Set(expectedTypes);

@@ -117,2 +117,3 @@ // if accepts are supplied, try to find a match, and use its validator

};
exports.findResponseContent = findResponseContent;
//# sourceMappingURL=util.js.map
{
"name": "express-openapi-validator",
"version": "4.12.7-alpha.1",
"version": "4.12.7",
"description": "Automatically validate API requests and responses with OpenAPI 3 and Express.",

@@ -51,24 +51,24 @@ "main": "dist/index.js",

"@types/cookie-parser": "^1.4.2",
"@types/express": "^4.17.8",
"@types/mocha": "^8.0.3",
"@types/morgan": "^1.9.1",
"@types/node": "^14.14.2",
"@types/supertest": "^2.0.10",
"@types/express": "4.17.8",
"@types/mocha": "^8.2.2",
"@types/morgan": "^1.9.2",
"@types/node": "^14.14.37",
"@types/supertest": "^2.0.11",
"body-parser": "^1.19.0",
"chai": "^4.2.0",
"chai": "^4.3.4",
"codacy-coverage": "^3.4.0",
"commitizen": "^4.2.2",
"commitizen": "^4.2.3",
"cookie-parser": "^1.4.5",
"coveralls": "^3.1.0",
"express": "^4.17.1",
"mocha": "^8.2.0",
"mocha": "^8.3.2",
"morgan": "^1.10.0",
"nodemon": "^2.0.6",
"nodemon": "^2.0.7",
"nyc": "^15.1.0",
"prettier": "^2.1.2",
"prettier": "^2.2.1",
"source-map-support": "0.5.19",
"supertest": "^5.0.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
"supertest": "^6.1.3",
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
}
}
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