schema.utils

Private utilities used in schema implementation.

assoc-when

(assoc-when m & kvs)
Like assoc but only assocs when value is truthy.  Copied from plumbing.core so that
schema need not depend on plumbing.

char-map

macro

(char-map)

class-schema

(class-schema klass)
The last schema for a class set by declare-class-schema!, or nil.

declare-class-schema!

(declare-class-schema! klass schema)
Globally set the schema for a class (above and beyond a simple instance? check).
Use with care, i.e., only on classes that you control.  Also note that this
schema only applies to instances of the concrete type passed, i.e.,
(= (class x) klass), not (instance? klass x).

error

(error x)
Distinguish a value (must be non-nil) as an error.

error-val

(error-val x)

error?

(error? x)

fn-name

(fn-name f)
A meaningful name for a function that looks like its symbol, if applicable.

fn-schema-bearer

(fn-schema-bearer f)
What class can we associate the fn schema with? In Clojure use the class of the fn; in
cljs just use the fn itself.

format*

(format* fmt & args)

make-ValidationError

(make-ValidationError schema value expectation-delay fail-explanation)
for cljs sake (easier than normalizing imports in macros.clj)

max-value-length

named-error-explain

(named-error-explain err)

record?

(record? x)

type-of

(type-of x)

unmunge

(unmunge s)
TODO: eventually use built in demunge in latest cljs.

use-fn-validation

Turn on run-time function validation for functions compiled when
s/compile-fn-validation was true -- has no effect for functions compiled
when it is false.

validation-error-explain

(validation-error-explain err)

value-name

(value-name value)
Provide a descriptive short name for a value.