Liking cljdoc? Tell your friends :D

schema-tools.coerce


+json-coercions+clj/s

source

+string-coercions+clj/s

source

coerceclj/s

(coerce value schema)
(coerce value schema matcher)
(coerce value schema matcher type)

Simultaneously coerces and validates a value to match the given schema. If a value can't be coerced to match the schema, an ex-info is thrown - like schema.core/validate, but with overridable :type, defaulting to :schema-tools.coerce/error.

Simultaneously coerces and validates a value to match the given `schema.` If a `value` can't
be coerced to match the `schema`, an `ex-info` is thrown - like `schema.core/validate`,
but with overridable `:type`, defaulting to `:schema-tools.coerce/error.`
sourceraw docstring

coercerclj/s

(coercer schema)
(coercer schema matcher)
(coercer schema matcher type)

Produce a function that simultaneously coerces and validates a value against a schema. If a value can't be coerced to match the schema, an ex-info is thrown - like schema.core/validate, but with overridable :type, defaulting to :schema-tools.coerce/error.

Produce a function that simultaneously coerces and validates a value against a `schema.`
If a value can't be coerced to match the schema, an `ex-info` is thrown - like `schema.core/validate`,
but with overridable `:type`, defaulting to `:schema-tools.coerce/error.`
sourceraw docstring

collection-matcherclj/s

(collection-matcher schema)
source

default-coercion-matcherclj/sdeprecated

Deprecated - use default-value-matcher instead.

Deprecated - use [[default-value-matcher]] instead.
sourceraw docstring

default-key-matcherclj/s

(default-key-matcher schema)

Creates a matcher which adds missing keys to a map if they have default values. You can set default values with schema-tools.core/default.

Creates a matcher which adds missing keys to a map if they have default values.
You can set default values with [[schema-tools.core/default]].
sourceraw docstring

default-matcherclj/s

(default-matcher schema)

Combination of default-value-matcher and default-key-matcher: Creates a matcher which adds missing keys with default values to a map and converts nils to default values. You can set default values with schema-tools.core/default.

Combination of [[default-value-matcher]] and [[default-key-matcher]]: Creates
a matcher which adds missing keys with default values to a map and converts
nils to default values. You can set default values with
[[schema-tools.core/default]].
sourceraw docstring

default-value-matcherclj/s

(default-value-matcher schema)

Creates a matcher which converts nils to default values. You can set default values with schema-tools.core/default.

Creates a matcher which converts nils to default values. You can set default values
with [[schema-tools.core/default]].
sourceraw docstring

json-coercion-matcherclj/s

source

keyword->boolclj/s

(keyword->bool x)
source

keyword->numberclj/s

(keyword->number x)
source

keyword->stringclj/s

(keyword->string x)
source

map-filter-matcherclj/s

(map-filter-matcher schema)

Creates a matcher which removes all illegal keys from non-record maps.

Creates a matcher which removes all illegal keys from non-record maps.
sourceraw docstring

multi-matcherclj/s

(multi-matcher accept-schema accept-value fs)

Creates a matcher for (accept-schema schema), reducing value with fs functions if (accept-value value).

Creates a matcher for (accept-schema schema), reducing
value with fs functions if (accept-value value).
sourceraw docstring

or-matcherclj/s

(or-matcher & matchers)

Creates a matcher where the first matcher matching the given schema is used.

Creates a matcher where the first matcher matching the
given schema is used.
sourceraw docstring

string->booleanclj/s

(string->boolean x)
source

string->dateclj/s

(string->date x)
source

string->doubleclj

(string->double x)
source

string->longclj

(string->long x)
source

string->numberclj/s

(string->number x)
source

string->uuidclj/s

(string->uuid x)
source

string-coercion-matcherclj/s

source

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

× close