express-openapi-validator
Advanced tools
Comparing version
@@ -60,5 +60,6 @@ "use strict"; | ||
// Get document, or throw exception on error | ||
return $refParser.mode === 'dereference' | ||
const doc = $refParser.mode === 'dereference' | ||
? $RefParser.dereference(absolutePath) | ||
: $RefParser.bundle(absolutePath); | ||
return doc; | ||
} | ||
@@ -69,5 +70,6 @@ else { | ||
} | ||
return $refParser.mode === 'dereference' | ||
const doc = $refParser.mode === 'dereference' | ||
? $RefParser.dereference(filePath) | ||
: $RefParser.bundle(filePath); | ||
return doc; | ||
} | ||
@@ -74,0 +76,0 @@ sortApiDocTags(apiDoc) { |
@@ -235,3 +235,4 @@ "use strict"; | ||
for (const option of options) { | ||
ancestor._discriminator.validators[option] = this.ajv.compile(newSchema); | ||
ancestor._discriminator.validators[option] = | ||
this.ajv.compile(newSchema); | ||
} | ||
@@ -352,4 +353,11 @@ } | ||
v.parameters = v.parameters || []; | ||
const match = (pathParam, opParam) => | ||
// if name or ref exists and are equal | ||
(opParam['name'] && opParam['name'] === pathParam['name']) || | ||
(opParam['$ref'] && opParam['$ref'] === pathParam['$ref']); | ||
// Add Path level query param to list ONLY if there is not already an operation-level query param by the same name. | ||
for (const param of parameters) { | ||
v.parameters.push(param); | ||
if (!v.parameters.some((vparam) => match(param, vparam))) { | ||
v.parameters.push(param); | ||
} | ||
} | ||
@@ -356,0 +364,0 @@ } |
{ | ||
"name": "express-openapi-validator", | ||
"version": "4.12.14", | ||
"version": "4.12.15", | ||
"description": "Automatically validate API requests and responses with OpenAPI 3 and Express.", | ||
@@ -35,6 +35,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@types/multer": "^1.4.5", | ||
"@types/multer": "^1.4.6", | ||
"ajv": "^6.12.6", | ||
"content-type": "^1.0.4", | ||
"json-schema-ref-parser": "^9.0.7", | ||
"json-schema-ref-parser": "^9.0.9", | ||
"lodash.clonedeep": "^4.5.0", | ||
@@ -41,0 +41,0 @@ "lodash.get": "^4.4.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
390642
0.25%5764
0.17%Updated