Dev-time conveniences gated by the stube.dev system property.
Currently exposes one thing: post-handler state-shape validation via
optional Malli schemas declared on :component/state (see S-9).
Production runs incur the cost of a single (when @dev-mode? …)
check, so the validation pipeline can sit unconditionally inside
kernel/dispatch without bloating the hot path.
Enable validation by either
-Dstube.dev=true ; system property
STUBE_DEV=true ; environment variable
or by binding *enabled?* true at the REPL.
Malli stays an optional dependency: the namespace is loaded via
requiring-resolve only when a schema is actually present and
dev mode is on. Apps that never declare a schema, or never enable
dev mode, do not need Malli on the classpath.
Dev-time conveniences gated by the `stube.dev` system property.
Currently exposes one thing: post-handler state-shape validation via
optional Malli schemas declared on `:component/state` (see S-9).
Production runs incur the cost of a single `(when @dev-mode? …)`
check, so the validation pipeline can sit unconditionally inside
`kernel/dispatch` without bloating the hot path.
Enable validation by either
-Dstube.dev=true ; system property
STUBE_DEV=true ; environment variable
or by binding [[*enabled?*]] true at the REPL.
Malli stays an optional dependency: the namespace is loaded via
`requiring-resolve` only when a schema is actually present *and*
dev mode is on. Apps that never declare a schema, or never enable
dev mode, do not need Malli on the classpath.Override the system-property-driven default at the REPL or in tests.
Override the system-property-driven default at the REPL or in tests.
(enabled?)True when component-state schema validation should fire after every handler return.
True when component-state schema validation should fire after every handler return.
(user-state self)Slice self down to the user-defined keys — the portion a
:component/state schema is meant to validate.
Slice `self` down to the user-defined keys — the portion a `:component/state` schema is meant to validate.
(validate! cdef self' phase)Validate self' against the component's :component/state schema if
one is declared and dev mode is enabled. Throws an ex-info
carrying the Malli explainer output on failure. Returns self'
unchanged on success or when validation is skipped.
Validate `self'` against the component's `:component/state` schema if one is declared *and* dev mode is enabled. Throws an `ex-info` carrying the Malli explainer output on failure. Returns `self'` unchanged on success or when validation is skipped.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |