Mismatch reason copy updates

This commit is contained in:
Abhijit Kane
2020-01-06 11:33:54 +05:30
parent 7a4c064751
commit 5ee68a6779

View File

@@ -1798,7 +1798,7 @@ module.exports = {
} }
else if (txnParamName) { else if (txnParamName) {
// for query params, req/res headers, path vars, we have a name. Praise the lord. // for query params, req/res headers, path vars, we have a name. Praise the lord.
reason = `The "${txnParamName}" ${humanPropName}`; reason = `The ${humanPropName} "${txnParamName}"`;
} }
else { else {
// for query params, req/res headers, path vars, we might not ALWAYS have a name. // for query params, req/res headers, path vars, we might not ALWAYS have a name.
@@ -1814,6 +1814,9 @@ module.exports = {
else if (Array.isArray(valueToUse)) { else if (Array.isArray(valueToUse)) {
reason += 'an array instead'; reason += 'an array instead';
} }
else if (typeof valueToUse === 'object') {
reason += 'an object instead';
}
else { else {
reason += `a ${typeof valueToUse} instead`; reason += `a ${typeof valueToUse} instead`;
} }
@@ -1956,7 +1959,7 @@ module.exports = {
transactionJsonPath: null, transactionJsonPath: null,
schemaJsonPath: pathVar.pathPrefix, schemaJsonPath: pathVar.pathPrefix,
reasonCode: 'MISSING_IN_REQUEST', reasonCode: 'MISSING_IN_REQUEST',
reason: `The required path variable ${pathVar.name} was not found in the transaction` reason: `The required path variable "${pathVar.name}" was not found in the transaction`
}); });
} }
}); });
@@ -2039,7 +2042,7 @@ module.exports = {
transactionJsonPath: null, transactionJsonPath: null,
schemaJsonPath: qp.pathPrefix + '[?(@.name==\'' + qp.name + '\')]', schemaJsonPath: qp.pathPrefix + '[?(@.name==\'' + qp.name + '\')]',
reasonCode: 'MISSING_IN_REQUEST', reasonCode: 'MISSING_IN_REQUEST',
reason: `The required query parameter ${qp.name} was not found in the transaction` reason: `The required query parameter "${qp.name}" was not found in the transaction`
}); });
} }
}); });
@@ -2099,7 +2102,7 @@ module.exports = {
transactionJsonPath: null, transactionJsonPath: null,
schemaJsonPath: header.pathPrefix + '[?(@.name==\'' + header.name + '\')]', schemaJsonPath: header.pathPrefix + '[?(@.name==\'' + header.name + '\')]',
reasonCode: 'MISSING_IN_REQUEST', reasonCode: 'MISSING_IN_REQUEST',
reason: `The required header ${header.name} was not found in the transaction` reason: `The required header "${header.name}" was not found in the transaction`
}); });
} }
}); });
@@ -2172,7 +2175,7 @@ module.exports = {
transactionJsonPath: null, transactionJsonPath: null,
schemaJsonPath: schemaPathPrefix + '.headers[\'' + header.name + '\']', schemaJsonPath: schemaPathPrefix + '.headers[\'' + header.name + '\']',
reasonCode: 'MISSING_IN_REQUEST', reasonCode: 'MISSING_IN_REQUEST',
reason: `The required header ${header.name} was not found in the transaction` reason: `The required response header "${header.name}" was not found in the transaction`
}); });
} }
}); });