|
|
@@ -24,9 +24,10 @@
|
|
|
|
|
|
#define VISITED(type) std::get<std::unordered_set<type>>(*visited_)
|
|
|
|
|
|
-#define VALIDATE_SUBSCHEMA_AND_MARK_LOCAL_VISIT(subschema, subinstance, path, local_visited) \
|
|
|
+#define VALIDATE_SUBSCHEMA_AND_MARK_LOCAL_VISIT(subschema, subinstance, path, local_visited, ...) \
|
|
|
do { \
|
|
|
- Status const partial = validate_subschema_on(subschema, subinstance, path); \
|
|
|
+ Status const partial = \
|
|
|
+ validate_subschema_on(subschema, subinstance, path __VA_OPT__(, ) __VA_ARGS__); \
|
|
|
rval &= partial; \
|
|
|
if (result_ and partial != Status::Noop) { \
|
|
|
local_visited.insert(local_visited.end(), path); \
|
|
|
@@ -509,7 +510,7 @@ public:
|
|
|
std::vector<std::string> properties;
|
|
|
for (auto const & [key, elem] : object) {
|
|
|
if (auto it = cons.properties.find(key); it != cons.properties.end()) {
|
|
|
- VALIDATE_SUBSCHEMA_AND_MARK_LOCAL_VISIT(it->second, elem, key, properties);
|
|
|
+ VALIDATE_SUBSCHEMA_AND_MARK_LOCAL_VISIT(it->second, elem, key, properties, key);
|
|
|
}
|
|
|
BREAK_EARLY_IF_NO_RESULT_TREE();
|
|
|
}
|
|
|
@@ -635,7 +636,8 @@ public:
|
|
|
for (auto const & [key, p_constraint] : schema_->constraints()) {
|
|
|
BREAK_EARLY_IF_NO_RESULT_TREE();
|
|
|
schema_path_ = current_schema / key;
|
|
|
- rval &= std::visit([this, &document](auto & c) { return visit(c, document); }, *p_constraint);
|
|
|
+ rval &= std::visit([this, &document](auto & c) { return this->visit(c, document); },
|
|
|
+ *p_constraint);
|
|
|
}
|
|
|
|
|
|
// Post Constraints represent the unevaluatedItems and unevaluatedProperties
|
|
|
@@ -643,7 +645,8 @@ public:
|
|
|
for (auto const & [key, p_constraint] : schema_->post_constraints()) {
|
|
|
BREAK_EARLY_IF_NO_RESULT_TREE();
|
|
|
schema_path_ = current_schema / key;
|
|
|
- rval &= std::visit([this, &document](auto & c) { return visit(c, document); }, *p_constraint);
|
|
|
+ rval &= std::visit([this, &document](auto & c) { return this->visit(c, document); },
|
|
|
+ *p_constraint);
|
|
|
}
|
|
|
|
|
|
(result_ ? result_->valid(where_, current_schema, static_cast<bool>(rval)) : void());
|
|
|
@@ -722,7 +725,7 @@ private:
|
|
|
if (schema::Node const * const * ppschema = std::get_if<0>(&subschema)) {
|
|
|
return validate_subschema(*ppschema, document, keys...);
|
|
|
} else {
|
|
|
- return std::visit([this, &document](auto & c) { return visit(c, document); },
|
|
|
+ return std::visit([this, &document](auto & c) { return this->visit(c, document); },
|
|
|
*std::get<1>(subschema));
|
|
|
}
|
|
|
}
|
|
|
@@ -770,11 +773,12 @@ private:
|
|
|
*/
|
|
|
template <typename K>
|
|
|
Status validate_subschema_on(schema::Node const * subschema, Adapter auto const & document,
|
|
|
- K const & key) const {
|
|
|
+ K const & key, auto const &... schema_keys) const {
|
|
|
ValidationResult result;
|
|
|
|
|
|
ValidationVisitor next = *this;
|
|
|
next.where_ /= key;
|
|
|
+ ((next.schema_path_ /= schema_keys), ...);
|
|
|
std::tie(next.schema_, next.result_, next.visited_) =
|
|
|
std::forward_as_tuple(subschema, result_ ? &result : nullptr, nullptr);
|
|
|
|