소스 검색

cleanup: dont double-add $ref

Sam Jaffe 3 주 전
부모
커밋
c4f4735743
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  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()) {