Liking cljdoc? Tell your friends :D
All platforms.

c3kit.apron.schema.types

Standard type lexes. A type lex has shape

{:validations [...] ; lex names / factory vectors / inline maps — run as type-level validation :coercions [...]} ; lex names / factory vectors / inline maps / bare fns — run as type-level coercion

default-types bundles them as a {name → lex} map that c3kit.apron.schema merges into the default lexicon at its load.

---- shape choice for default types ----

Default types' :validations use inline {:validate fn :message msg} maps rather than composed [:maybe? :foo?] lex references. The composed form reads more elegantly but costs a few lexicon lookups per validation pass; the inline form pays nothing.

Both shapes follow the same message precedence (entry's :message wins, spec :message is a fallback), so the choice between them is just about runtime cost vs. composition style.

:coercions use bare coercer fns so that coerce-ex's specific 'can't coerce VALUE to TYPE' message reaches the caller. Named coercion lexes there would substitute the lex's generic 'could not coerce to int' message instead.

User-defined types are free to use either form for either slot.

---- nil tolerance ----

Default types allow nil by wrapping the type predicate in (validators/nil?-or ...). Users who want strict non-nil checking add :present? to their spec's :validations.

---- structural types ----

:one-of, :seq, and :map are structural — c3kit.apron.schema's process-spec-on-value dispatches on them before the type lex's validations / coercions would run. They're included here so the lex names resolve and conform-schema! recognizes them as valid types.

This namespace is pure data; it does not require c3kit.apron.schema.

Standard type lexes. A type lex has shape

   {:validations [...]   ; lex names / factory vectors / inline maps — run as type-level validation
    :coercions   [...]}  ; lex names / factory vectors / inline maps / bare fns — run as type-level coercion

default-types bundles them as a {name → lex} map that
c3kit.apron.schema merges into the default lexicon at its load.

---- shape choice for default types ----

Default types' :validations use inline {:validate fn :message msg}
maps rather than composed [:maybe? :foo?] lex references. The
composed form reads more elegantly but costs a few lexicon lookups
per validation pass; the inline form pays nothing.

Both shapes follow the same message precedence (entry's :message
wins, spec :message is a fallback), so the choice between them is
just about runtime cost vs. composition style.

:coercions use bare coercer fns so that coerce-ex's specific
'can't coerce VALUE to TYPE' message reaches the caller. Named
coercion lexes there would substitute the lex's generic
'could not coerce to int' message instead.

User-defined types are free to use either form for either slot.

---- nil tolerance ----

Default types allow nil by wrapping the type predicate in
(validators/nil?-or ...). Users who want strict non-nil checking
add :present? to their spec's :validations.

---- structural types ----

:one-of, :seq, and :map are structural — c3kit.apron.schema's
process-spec-on-value dispatches on them before the type lex's
validations / coercions would run. They're included here so the
lex names resolve and conform-schema! recognizes them as valid
types.

This namespace is pure data; it does not require c3kit.apron.schema.
raw docstring

default-typesclj/s

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close