   (valid? [this]
     (empty? errors)))
 
-(defn create-form [value validator]
-  (->Form (reagent/atom {::value    value
-                         ::original value
-                         })
-          #(->ValidationResult (-> %
-                                 (st/validate validator)
-                                 first))))
+(deftype StructValidator [schema]
+  Validator
+  (validate [this value]
+    (->ValidationResult (-> (st/validate value schema)
+                            first))))
+(defn struct-validator [schema]
+  (->StructValidator schema))
+
+(defn create-form
+  ([value]
+   (create-form value nil))
+  ([value validator]
+   (->Form (reagent/atom {::value    value
+                          ::original value
+                          })
+           validator)))
 
 (defn handle-str-value [field]
   #(set-str-value! field (-> % .-target .-value)))

  (:require-macros
    [devcards.core :as dc :refer [defcard deftest defcard-rg]]
    [reagent.ratom :refer [reaction]]
    ))

(enable-console-print!)

  ([value validator f & args]
   (let [new-value (apply f value args)]
     (-> new-value
         (assoc ::validator-errors (validate validator (::value new-value)))))))

(extend-type nil
  Validator
  (validate [this value]
    nil)

  Validatable
  (valid? [this]
    true)
