Explorar o código

fix: add expect in JSON-Pointer for leading /

Sam Jaffe hai 3 meses
pai
achega
af31329f15
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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));
     };
 
-    // 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);
     // 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