diff --git a/include/valijson/validation_visitor.hpp b/include/valijson/validation_visitor.hpp index 947d7ec..b973953 100644 --- a/include/valijson/validation_visitor.hpp +++ b/include/valijson/validation_visitor.hpp @@ -1013,11 +1013,7 @@ public: virtual bool visit(const RequiredConstraint &constraint) { if ((strictTypes && !target.isObject()) || !target.maybeObject()) { - if (results) { - results->pushError(context, - "Object required to validate 'required' properties."); - } - return false; + return true; } bool validated = true; diff --git a/tests/test_validator.cpp b/tests/test_validator.cpp index 00ca154..489015b 100644 --- a/tests/test_validator.cpp +++ b/tests/test_validator.cpp @@ -554,7 +554,10 @@ TEST_F(TestValidator, Draft7_Properties) // TODO: broken refRemote -// TODO: broken required +TEST_F(TestValidator, Draft7_Required) +{ + processDraft7TestFile(TEST_SUITE_DIR "draft7/required.json"); +} TEST_F(TestValidator, Draft7_Type) {