Skip to content

Commit f60f7e6

Browse files
author
omer
committed
adding a check for requestBody on current path and method before extracting the schema
1 parent 365763f commit f60f7e6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/swagger3/open-api3.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
};
1111

1212
function buildBodyValidation(dereferenced, originalSwagger, currentPath, currentMethod, middlewareOptions = {}) {
13+
if (!dereferenced.paths[currentPath][currentMethod].requestBody){
14+
return;
15+
}
1316
const bodySchemaV3 = dereferenced.paths[currentPath][currentMethod].requestBody.content['application/json'].schema;
1417
const defaultAjvOptions = {
1518
allErrors: true
@@ -96,4 +99,4 @@ function findKey(object, searchFunc) {
9699
return keys[i];
97100
}
98101
}
99-
}
102+
}

0 commit comments

Comments
 (0)