Parcourir la source

refactor: remove extra guard on "json-pointer" format

Sam Jaffe il y a 3 mois
Parent
commit
ea5e823892
1 fichiers modifiés avec 1 ajouts et 11 suppressions
  1. 1 11
      include/jvalidate/format.h

+ 1 - 11
include/jvalidate/format.h

@@ -274,16 +274,6 @@ template <typename T> inline bool ctor_as_valid(std::string_view str) {
     return true;
   } catch (std::exception const &) { return false; }
 }
-
-inline bool json_pointer(std::string_view ptr) {
-  if (not ptr.empty() && not ptr.starts_with('/')) {
-    return false;
-  }
-  try {
-    [[maybe_unused]] ::jvalidate::detail::Pointer _{ptr};
-    return true;
-  } catch (std::exception const & ex) { return false; }
-}
 }
 
 namespace jvalidate {
@@ -305,7 +295,7 @@ private:
       {"ipv6", &format::ipv6},
       {"iri", nullptr},
       {"iri-reference", nullptr},
-      {"json-pointer", &format::json_pointer},
+      {"json-pointer", &format::ctor_as_valid<detail::Pointer>},
       {"relative-json-pointer", &format::ctor_as_valid<detail::RelativePointer>},
       {"regex", nullptr},
       {"time", &format::time},