Added handling to report missing in collection mismatch only for required properties

This commit is contained in:
Vishal Shingala
2021-02-19 10:34:55 +05:30
parent 373c3aba5f
commit f95435749c

View File

@@ -3831,6 +3831,10 @@ module.exports = {
_.has(encodingValue, 'explode') && (resolvedProp.explode = encodingValue.explode);
}
if (_.includes(_.get(urlencodedBodySchema, 'required'), propName)) {
resolvedProp.required = true;
}
pSerialisationInfo = this.getParamSerialisationInfo(resolvedProp, PARAMETER_SOURCE.REQUEST,
components, schemaCache);
isPropSeparable = _.includes(['form', 'deepObject'], pSerialisationInfo.style);
@@ -3929,7 +3933,8 @@ module.exports = {
});
_.each(resolvedSchemaParams, (uParam) => {
if (!_.find(requestBody.urlencoded, (param) => { return param.key === uParam.name; })) {
// report mismatches only for reuired properties
if (!_.find(requestBody.urlencoded, (param) => { return param.key === uParam.name; }) && uParam.required) {
mismatchObj = {
property: mismatchProperty,
transactionJsonPath: transactionPathPrefix + '.urlencoded',