Liking cljdoc? Tell your friends :D

hara.data.pipeline.validate


wrap-single-model-validateclj

(wrap-single-model-validate f)

validates input according to model

(pipeline/normalise {:account/name "Chris"} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:validate {:account {:name number?}}}} wrappers) => (throws-info {:not-validated true :nsv [:account :name]})

(pipeline/normalise {:account/name "Bob"} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:validate {:account {:name #(= % "Bob")}}}} wrappers) => {:account {:name "Bob"}}

validates input according to model

(pipeline/normalise {:account/name "Chris"}
                    {:schema (schema/schema examples/account-name-age-sex)
                     :pipeline {:validate {:account {:name number?}}}}
                    *wrappers*)
 => (throws-info {:not-validated true :nsv [:account :name]})

 (pipeline/normalise {:account/name "Bob"}
                      {:schema (schema/schema examples/account-name-age-sex)
                       :pipeline {:validate {:account {:name #(= % "Bob")}}}}
                      *wrappers*)
 => {:account {:name "Bob"}}
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close