Ensure validation state is not discarded after checking for an 'additionalProperties' constraint

This commit is contained in:
Tristan Penman 2016-02-17 08:47:13 -08:00
parent b241b37d7a
commit e9b50162bf

View File

@ -853,7 +853,17 @@ public:
const Subschema *additionalPropertiesSubschema =
constraint.getAdditionalPropertiesSubschema();
if (!additionalPropertiesSubschema) {
return propertiesMatched.size() == target.getObjectSize();
if (propertiesMatched.size() != target.getObjectSize()) {
if (results) {
results->pushError(context, "Object contains properties "
"that could not be validated using 'properties' "
"or 'additionalProperties' constraints");
}
return false;
}
return validated;
}
BOOST_FOREACH( const typename AdapterType::ObjectMember m, object ) {