Forráskód Böngészése

cleanup: dont double-add $ref

Sam Jaffe 3 hete
szülő
commit
c4f4735743
1 módosított fájl, 5 hozzáadás és 1 törlés
  1. 5 1
      include/jvalidate/validation_visitor.h

+ 5 - 1
include/jvalidate/validation_visitor.h

@@ -625,7 +625,11 @@ public:
     // constraints. This is enforced in the parsing of the schema, rather than
     // during validation {@see jvalidate::schema::Node::construct}.
     if (std::optional<schema::Node const *> ref = schema_->reference_schema()) {
-      rval = validate_subschema(*ref, document, "$ref");
+      if (schema_path_.empty() || schema_path_.back() != "$ref") {
+        rval = validate_subschema(*ref, document, "$ref");
+      } else {
+        rval = validate_subschema(*ref, document);
+      }
     }
 
     if (result_ && !schema_->description().empty()) {