Schema-driven validation entails that each structure can incorporate yet another validating structure.
Schema-driven validation entails that each structure can incorporate yet another validating structure.
(find-schema alias)
Finds schema
in schema registry
Finds `schema` in schema registry
(register-schema alias schema)
Register schema
in a registry, it then can be access via provided alias
Register `schema` in a registry, it then can be access via provided `alias`
(unregister-schema alias)
Unregisters schema
from registry making it unavailable
Unregisters `schema` from registry making it unavailable
(valid? coll schema)
Quickly tests if provided col
is valid, schema can be alias
Quickly tests if provided `col` is valid, schema can be alias
(validate coll schema)
(validate coll schema options)
Validates provided structure against schema
. Schema can be alias. Returns a map of keys that are erroneous.
Example
(validate {:key [0 1 2 3]} {:key int?}))
;=>
{}
(validate {:key [0 1 2 3 false]} {:key int?})
;=>
{:key [{:value false :validators [0]}]}
(validate :invalid {:validators (fn [value] (str "this value is " (name value)))})
;=>
{:value :invalid :validators ["this value is invalid"]}
See also: validate-schema
Validates provided structure against `schema`. Schema can be alias. Returns a map of keys that are erroneous. **Example** ```clojure (validate {:key [0 1 2 3]} {:key int?})) ;=> {} (validate {:key [0 1 2 3 false]} {:key int?}) ;=> {:key [{:value false :validators [0]}]} (validate :invalid {:validators (fn [value] (str "this value is " (name value)))}) ;=> {:value :invalid :validators ["this value is invalid"]} ``` See also: [[validate-schema]]
(validate-schema schema)
Validates provided schema for correctness. Returns a map of keys that are erroneous.
Example
(validate-schema {:key int?})
;=>
{}
(validate-schema {:key {:required? :invalid-value :validators []}})
;=>
{:key {:required? {:validators [0] :value :invalid-value}}}
See also: validate
Validates provided schema for correctness. Returns a map of keys that are erroneous. **Example** ```clojure (validate-schema {:key int?}) ;=> {} (validate-schema {:key {:required? :invalid-value :validators []}}) ;=> {:key {:required? {:validators [0] :value :invalid-value}}} ``` See also: [[validate]]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close