Liking cljdoc? Tell your friends :D

hara.data.pipeline.require


process-requireclj

(process-require req require-key tdata nsv tsch datasource)

Checks for correct entry

(require/process-require {:name :checked} :no-required {:name "Chris"} [:account] (-> (schema/schema examples/account-name-age-sex) :tree :account) {}) => {:name "Chris"}

Checks for correct entry

 (require/process-require {:name :checked}
                          :no-required
                          {:name "Chris"}
                          [:account]
                          (-> (schema/schema examples/account-name-age-sex)
                              :tree
                              :account)
                          {})
=> {:name "Chris"}
raw docstring

wrap-model-post-requireclj

(wrap-model-post-require f)

Checks for data across elements and schema post transforms

(pipeline/normalise {:account/name "Chris"} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:post-require {:account {:name :checked}}}} {:normalise [require/wrap-model-post-require]}) => {:account {:name "Chris"}}

(pipeline/normalise {:account/age 10} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:post-require {:account {:name :checked}}}} {:normalise [require/wrap-model-post-require]}) => (throws-info {:nsv [:account :name] :no-required true})

Checks for data across elements and schema post transforms

(pipeline/normalise
 {:account/name "Chris"}
 {:schema (schema/schema examples/account-name-age-sex)
  :pipeline {:post-require {:account {:name :checked}}}}
 {:normalise [require/wrap-model-post-require]})
=> {:account {:name "Chris"}}

(pipeline/normalise
 {:account/age 10}
 {:schema (schema/schema examples/account-name-age-sex)
  :pipeline {:post-require
             {:account {:name :checked}}}}
 {:normalise [require/wrap-model-post-require]})
=> (throws-info {:nsv [:account :name]
                 :no-required true})
raw docstring

wrap-model-pre-requireclj

(wrap-model-pre-require f)

Checks for data across elements and schema pre transforms (pipeline/normalise {:account/orders #{{:number 1} {:number 2}}} {:schema (schema/schema examples/account-orders-items-image) :pipeline {:pre-require {:account {:orders {:number :checked}}}}} wrappers) => {:account {:orders #{{:number 1} {:number 2}}}}

(pipeline/normalise {:account/orders #{{:items {:name "stuff"}} {:number 2}}} {:schema (schema/schema examples/account-orders-items-image) :pipeline {:pre-require {:account {:orders {:number :checked}}}}} wrappers) => (throws-info {:data {:items {:name "stuff"}} :nsv [:order :number] :no-required true})

Checks for data across elements and schema pre transforms
(pipeline/normalise
 {:account/orders #{{:number 1}
                    {:number 2}}}
 {:schema (schema/schema examples/account-orders-items-image)
  :pipeline {:pre-require
             {:account {:orders
                        {:number :checked}}}}}
 *wrappers*)
=> {:account {:orders #{{:number 1}
                        {:number 2}}}}

(pipeline/normalise
 {:account/orders #{{:items {:name "stuff"}}
                    {:number 2}}}
 {:schema (schema/schema
           examples/account-orders-items-image)
  :pipeline {:pre-require
             {:account
              {:orders {:number :checked}}}}}
 *wrappers*)
=> (throws-info {:data {:items {:name "stuff"}}
                :nsv [:order :number]
                 :no-required true})
raw docstring

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

× close