mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fixed datapath access for when path starts with array
This commit is contained in:
@@ -2363,6 +2363,13 @@ module.exports = {
|
||||
|
||||
// Filter validation errors for following cases
|
||||
filteredValidationError = _.filter(_.get(validate, 'errors', []), (validationError) => {
|
||||
let dataPath = _.get(validationError, 'dataPath', '');
|
||||
|
||||
// discard the leading '.' if it exists
|
||||
if (dataPath[0] === '.') {
|
||||
dataPath = dataPath.slice(1);
|
||||
}
|
||||
|
||||
// for invalid `propertyNames` two error are thrown by Ajv, which include error with `pattern` keyword
|
||||
if (validationError.keyword === 'pattern') {
|
||||
return !_.has(validationError, 'propertyName');
|
||||
@@ -2376,7 +2383,7 @@ module.exports = {
|
||||
|
||||
// Ignore unresolved variables from mismatch if option is set
|
||||
else if (options.ignoreUnresolvedVariables &&
|
||||
this.isPmVariable(_.get(valueToUse, validationError.dataPath.slice(1)))) {
|
||||
this.isPmVariable(_.get(valueToUse, dataPath))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user