Liking cljdoc? Tell your friends :D

daaku.schema


booleanclj/s

(boolean)
(boolean {:keys [msg] :or {msg "This must be a boolean."}})

Indicates the field must be a boolean.

Indicates the field must be a boolean.
sourceraw docstring

compclj/s

(comp & fns)

Compose multiple validators together.

Compose multiple validators together.
sourceraw docstring

defaultclj/s

(default d)

Provides a default value to be used when the provided value is nil.

Provides a default value to be used when the provided value is nil.
sourceraw docstring

doubleclj/s

(double)
(double {:keys [msg] :or {msg "This must be a double."}})

Indicates the field must be a double.

Indicates the field must be a double.
sourceraw docstring

errorclj/s

(error v)

Use this function to return an error on validation failure.

Use this function to return an error on validation failure.
sourceraw docstring

error-valueclj/s

(error-value v)

Returns the error value from v.

Returns the error value from `v`.
sourceraw docstring

error?clj/s

(error? v)

Returns true if v contains an error.

Returns true if `v` contains an error.
sourceraw docstring

floatclj/s

(float)
(float {:keys [msg] :or {msg "This must be a float."}})

Indicates the field must be a float.

Indicates the field must be a float.
sourceraw docstring

greater-or-equalclj/s

(greater-or-equal target)
(greater-or-equal target
                  {:keys [msg]
                   :or {msg "This value is less than the allowed value."}})

Ensure the value is greater than or equal to the provided value. Comparisons are made using compare.

Ensure the value is greater than or equal to the provided value.
Comparisons are made using `compare`.
sourceraw docstring

greater-thanclj/s

(greater-than target)
(greater-than target
              {:keys [msg]
               :or {msg "This value is less than the allowed value."}})

Ensure the value is greater than the provided value. Comparisons are made using compare.

Ensure the value is greater than the provided value. Comparisons are made
using `compare`.
sourceraw docstring

inclj/s

(in coll)
(in coll {:keys [msg] :or {msg "This is not one of the allowed values."}})

Indicates the field must be contained as defined by contains? in the collection provided as in.

Indicates the field must be contained as defined by `contains?` in the
collection provided as `in`.
sourceraw docstring

intclj/s

(int)
(int {:keys [msg] :or {msg "This must be a integer."}})

Indicates the field must be a integer.

Indicates the field must be a integer.
sourceraw docstring

keywordclj/s

(keyword)
(keyword {:keys [msg] :or {msg "This must be a keyword."}})

Indicates the field must be a keyword.

Indicates the field must be a keyword.
sourceraw docstring

less-or-equalclj/s

(less-or-equal target)
(less-or-equal target
               {:keys [msg]
                :or {msg "This value is more than the allowed value."}})

Ensure the value is less than or equal to the provided value. Comparisons are made using compare.

Ensure the value is less than or equal to the provided value.
Comparisons are made using `compare`.
sourceraw docstring

less-thanclj/s

(less-than target)
(less-than target
           {:keys [msg] :or {msg "This value is more than the allowed value."}})

Ensure the value is less than the provided value. Comparisons are made using compare.

Ensure the value is less than the provided value. Comparisons are made
using `compare`.
sourceraw docstring

longclj/s≠

clj
(long)
(long {:keys [msg] :or {msg "This must be a long."}})

Indicates the field must be a long.

Indicates the field must be a long.
cljs
source (clj)source (cljs)raw docstring

negativeclj/s

(negative)
(negative {:keys [msg] :or {msg "This value must be negative."}})

Ensure the value is negative checked by neg?.

Ensure the value is negative checked by `neg?`.
sourceraw docstring

non-emptyclj/s

(non-empty)
(non-empty {:keys [msg] :or {msg "This value cannot be empty."}})

Ensures the value is non-empty.

Ensures the value is non-empty.
sourceraw docstring

numberclj/s

(number)
(number {:keys [msg] :or {msg "This must be a number."}})

Indicates the field must be a number.

Indicates the field must be a number.
sourceraw docstring

optionalclj/s

(optional)

Indicates the field is optional.

Indicates the field is optional.
sourceraw docstring

positiveclj/s

(positive)
(positive {:keys [msg] :or {msg "This value must be positive."}})

Ensure the value is positive checked by pos?.

Ensure the value is positive checked by `pos?`.
sourceraw docstring

rangeclj/s

(range start end)
(range start
       end
       {:keys [msg] :or {msg "This value is outside the allowed range."}})

Ensure the value is the given range, start and end inclusive. Comparisons are made using compare.

Ensure the value is the given range, start and end inclusive. Comparisons
are made using `compare`.
sourceraw docstring

re-matchclj/s

(re-match re)
(re-match re
          {:keys [msg]
           :or {msg "This value does not match the expected pattern."}})

Ensure the value matches the provided regular expression. If the value is not a string, it is considered not to match.

Ensure the value matches the provided regular expression. If the value is
not a string, it is considered not to match.
sourceraw docstring

requiredclj/s

(required)
(required {:keys [msg] :or {msg "This must be provided."}})

Indicates the field is required.

Indicates the field is required.
sourceraw docstring

schemaclj/s

(schema m)
(schema m
        {:keys [extra msg]
         :or {extra :fail msg "This field was not expected."}})

Schema takes a map of keys to validators. Optionally :extra can be configured to one of :fail (the default), :drop or :pass to indicate the behavior of extra keys.

Schema takes a map of keys to validators. Optionally `:extra` can be
configured to one of `:fail` (the default), `:drop` or `:pass` to
indicate the behavior of extra keys.
sourceraw docstring

setclj/s

(set)
(set {:keys [msg] :or {msg "This must be a set."}})

Indicates the field must be a set.

Indicates the field must be a set.
sourceraw docstring

stringclj/s

(string)
(string {:keys [msg] :or {msg "This must be a string."}})

Indicates the field must be a string.

Indicates the field must be a string.
sourceraw docstring

to-booleanclj/s

(to-boolean)
(to-boolean {:keys [msg]
             :or {msg "This value could not be converted to a boolean."}})

Parse strings using the following rules: true | yes | enable | on | 1 => true false | no | disable | off | 0 => false

Parse numbers using the following rules: 1 => true 0 => false

Other values are unacceptable.

Parse strings using the following rules:
  `true | yes | enable | on | 1 => true`
  `false | no | disable | off | 0 => false`

Parse numbers using the following rules:
  `1 => true`
  `0 => false`

Other values are unacceptable.
sourceraw docstring

to-doubleclj/s≠

clj
(to-double)
(to-double {:keys [msg]
            :or {msg "This value could not be converted to a double."}})

Parse strings using Double/parseDouble and cast other values using double.

Parse strings using `Double/parseDouble` and cast other values using
`double`.
cljs
source (clj)source (cljs)raw docstring

to-floatclj/s

(to-float)
(to-float {:keys [msg]
           :or {msg "This value could not be converted to a float."}})

Parse strings using Float/parseInt and cast other values using float.

Parse strings using `Float/parseInt` and cast other values using `float`.
sourceraw docstring

to-intclj/s

(to-int)
(to-int {:keys [msg]
         :or {msg "This value could not be converted to an integer."}})

Parse strings using Integer/parseInt and cast other values using int.

Parse strings using `Integer/parseInt` and cast other values using `int`.
sourceraw docstring

to-setclj/s

(to-set)
(to-set sc)

Convert a collection or a single value into a set. Optionally applies the given schema to each value.

Convert a collection or a single value into a set. Optionally applies
the given schema to each value.
sourceraw docstring

to-stringclj/s

(to-string)

Apply str to input.

Apply `str` to input.
sourceraw docstring

to-vectorclj/s

(to-vector)
(to-vector sc)

Convert a collection or a single value into a vector. Optionally applies the given schema to each value.

Convert a collection or a single value into a vector. Optionally applies
the given schema to each value.
sourceraw docstring

trimclj/s

(trim)

Trims leading and trailing whitespace.

Trims leading and trailing whitespace.
sourceraw docstring

vectorclj/s

(vector)
(vector {:keys [msg] :or {msg "This must be a vector."}})

Indicates the field must be a vector.

Indicates the field must be a vector.
sourceraw docstring

zero-or-positiveclj/s

(zero-or-positive)
(zero-or-positive {:keys [msg]
                   :or {msg "This value must be zero or positive."}})

Ensure the value is zero or positive checked by pos?.

Ensure the value is zero or positive checked by `pos?`.
sourceraw docstring

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

× close