mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fixed issue where validation was giving INVALID_TYPE instead of MISSING_IN_REQUEST if path variable is not present in transaction
This commit is contained in:
@@ -3233,6 +3233,11 @@ module.exports = {
|
||||
return cb(null, mismatches);
|
||||
}
|
||||
|
||||
// don't validate variable if not present in transaction
|
||||
if (!pathVar._varMatched) {
|
||||
return cb(null, mismatches);
|
||||
}
|
||||
|
||||
// assign parameter example(s) as schema examples
|
||||
this.assignParameterExamples(schemaPathVar);
|
||||
|
||||
@@ -3264,7 +3269,9 @@ module.exports = {
|
||||
|
||||
// go through required schemaPathVariables, and params that aren't found in the given transaction are errors
|
||||
_.each(schemaPathVariables, (pathVar) => {
|
||||
if (!_.find(determinedPathVariables, (param) => { return param.key === pathVar.name; })) {
|
||||
if (!_.find(determinedPathVariables, (param) => {
|
||||
return param.key === pathVar.name && param._varMatched;
|
||||
})) {
|
||||
|
||||
// assign parameter example(s) as schema examples;
|
||||
this.assignParameterExamples(pathVar);
|
||||
|
||||
@@ -447,6 +447,8 @@ class SchemaPack {
|
||||
return transactionPathVar.key === pathVar.key;
|
||||
});
|
||||
pathVar.value = _.get(mappedPathVar, 'value', pathVar.value);
|
||||
// set _varMatched flag which represents if variable was found in transaction or not
|
||||
pathVar._varMatched = !_.isEmpty(mappedPathVar);
|
||||
});
|
||||
|
||||
// resolve $ref in all parameter objects if present
|
||||
|
||||
Reference in New Issue
Block a user