瀏覽代碼

fix: add expect in JSON-Pointer for leading /

Sam Jaffe 3 月之前
父節點
當前提交
af31329f15
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      include/jvalidate/detail/pointer.h

+ 2 - 2
include/jvalidate/detail/pointer.h

@@ -82,8 +82,8 @@ public:
       tokens_.push_back(std::move(in));
       tokens_.push_back(std::move(in));
     };
     };
 
 
-    // JSON-Pointers are required to start with a '/' although we only enforce
-    // that rule in Reference.
+    // JSON-Pointers are required to start with a '/'.
+    EXPECT_M(path.starts_with('/'), "Missing leading '/' in JSON Pointer: " << path);
     path.remove_prefix(1);
     path.remove_prefix(1);
     // The rules of JSON-Pointer is that if a token were to contain a '/' as a
     // The rules of JSON-Pointer is that if a token were to contain a '/' as a
     // strict character: then that character would be escaped, using the above
     // strict character: then that character would be escaped, using the above