Ver Fonte

fix: merge errors

Sam Jaffe há 1 ano atrás
pai
commit
61cc10d79b
1 ficheiros alterados com 5 adições e 7 exclusões
  1. 5 7
      include/jvalidate/validation_visitor.h

+ 5 - 7
include/jvalidate/validation_visitor.h

@@ -85,12 +85,10 @@ public:
     auto is_equal = [this](auto const & frozen) {
       return document_.equals(frozen, cfg_.strict_equality);
     };
-    size_t index = 0;
-    for (auto const & option : cons.enumeration) {
+    for (auto const & [index, option] : detail::enumerate(cons.enumeration)) {
       if (option->apply(is_equal)) {
         return note(Status::Accept, "value is enum ", index);
       }
-      ++index;
     }
     return note(Status::Reject, "value is none of the enums");
   }
@@ -158,7 +156,7 @@ public:
   }
 
   Status visit(constraint::ConditionalConstraint const & cons) const {
-    bool const if_true = [this, &cons]() {
+    Status const if_true = [this, &cons]() {
       scoped_state(tracking_, StoreResults::ForAnything);
       return validate_subschema(cons.if_constraint);
     }();
@@ -230,7 +228,7 @@ public:
   Status visit(constraint::MinLengthConstraint const & cons) const {
     NOOP_UNLESS_TYPE(String);
     std::string const str = document_.as_string();
-    if (int64_t len = detail::length(str); len > cons.value) {
+    if (int64_t len = detail::length(str); len < cons.value) {
       return note(Status::Reject, "'", str, "' of length ", len, " is <", cons.value);
     } else {
       return note(Status::Accept, "'", str, "' of length ", len, " is >=", cons.value);
@@ -308,7 +306,7 @@ public:
 
   Status visit(constraint::MinItemsConstraint const & cons) const {
     NOOP_UNLESS_TYPE(Array);
-    if (size_t size = document_.array_size(); size > cons.value) {
+    if (size_t size = document_.array_size(); size < cons.value) {
       return note(Status::Reject, "array of size ", size, " is <", cons.value);
     } else {
       return note(Status::Accept, "array of size ", size, " is >=", cons.value);
@@ -421,7 +419,7 @@ public:
 
   Status visit(constraint::MinPropertiesConstraint const & cons) const {
     NOOP_UNLESS_TYPE(Object);
-    if (size_t size = document_.object_size(); size > cons.value) {
+    if (size_t size = document_.object_size(); size < cons.value) {
       return note(Status::Reject, "object of size ", size, " is <", cons.value);
     } else {
       return note(Status::Accept, "object of size ", size, " is >=", cons.value);