From 0b7efb3763fe8374faf37d4a6c74164c42465267 Mon Sep 17 00:00:00 2001 From: Tristan Penman Date: Thu, 24 Aug 2023 20:45:43 +1000 Subject: [PATCH] Make subschema constraint validation clearer --- include/valijson/subschema.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/valijson/subschema.hpp b/include/valijson/subschema.hpp index 5e22bf5..b74806e 100644 --- a/include/valijson/subschema.hpp +++ b/include/valijson/subschema.hpp @@ -120,7 +120,12 @@ public: { bool allTrue = true; for (auto &&constraint : m_constraints) { - allTrue = applyFunction(*constraint) && allTrue; + // Even if an application fails, we want to continue checking the + // schema. In that case we set allTrue to false, and then fall + // through to the next constraint + if (!applyFunction(*constraint)) { + allTrue = false; + } } return allTrue;