-
prune-optionals: standalone pruning of any schema — removes every optional subtree that contains no required attribute. Takes an optional keep-selection (positional, selection notation): mentioned entries are kept but stay optional. For:multischemas, mentioning branches keeps only those branches. See the README's "Pruning" section. -
select-only: explicit alternative to^:onlymetadata /{:prune-optionals true}; forces pruning (also when the caller passes:prune-optionals false). -
:multischema support: branches are selected with a map-selection — keys are dispatch values, values are sub-selections.{:human [:name]}requires:namein branch:human; unmentioned branches become all-optional.'*as branch key addresses every branch (its sub-selection must be satisfiable in each;'*merges with explicit branch keys). A keyword:dispatchkey is auto-required in every explicit map-branch. Pruning (^:only) drops unmentioned branches (mentioning none keeps all).selectable-pathsand verification errors spell branch segments as{:branch dispatch-value}, and shape mismatches (vector selection on a:multi, map selection on a:map) come with a:hint. See the README's "Multi-schemas" section, incl. limitations. -
ClojureScript support: the library is now
.cljcand tested on Node (clojure -M:cljs-test) as well as the JVM. -
:verify-selectionaccepts two new values besides:throw/:assertand the:skip/nil/falseopt-outs::log(print a warning — stderr on Clojure,console.warnon ClojureScript — and continue) and a function (called with{:paths ... :available ...}, selection continues). -
The dynamic var
*verify-selection*(initially:throw) provides the default for the:verify-selectionoption; an explicitly passed option still wins.
- An invalid selection now throws an
ExceptionInfoinstead of anAssertionError. This makes it catchable via(catch ExceptionInfo e ...)and works in ClojureScript (where asserts may be elided in release builds). The unknown and available paths are available as data:If you were catching(ex-data e) ;; => {:type :malli-select.core/unknown-paths ;; :data {:paths (...), :available (...)}}
AssertionErroror matching the assert message, update your code. The preferred spelling of the:verify-selectionoption is now:throw(the default);:assertstill works, as do the:skip/nil/falseopt-outs. - Selections with duplicate keys now merge instead of "last wins"
(
404d677).[{:friends [:name]} {:friends [:age]}]now requires both:nameand:ageof friends; it used to require only:age. The merge is a union of required paths, so results only get stricter, and it applies at every nesting level. Consequences:- To override instead of merge, build a single map yourself.
- A later
{:friends []}is now a no-op; it used to reset the:friendssub-selection to all-optional. - With
:prune-optionals/^:only, merged selections keep more attributes, so generated samples can gain fields.
Older releases are documented on the GitHub releases page.