(-keys
{:keys [keys strs syms] :as arg}
{:keys [:malli.destructure/references] :or {references true} :as options})
(-map arg
{:keys [:malli.destructure/references :malli.destructure/required-keys
:malli.destructure/closed-maps :malli.destructure/sequential-maps]
:or {references true sequential-maps true}
:as options}
rest)
(infer var)
(infer var options)
Infers a schema from a function Var. Best effort.
Infers a schema from a function Var. Best effort.
(parse arglist)
(parse arglist
{:keys [:malli.destructure/inline-schemas]
:or {inline-schemas true}
:as options})
Takes a destructuring bindings vector (arglist) and returns a map with keys:
key | description |
---|---|
:raw-arglist | the original arglist (can have type-hints) |
:arglist | simplified clojure arglist (no type-hints) |
:schema | extracted malli schema |
:parsed | full parse results |
Parsing can be configured using the following options:
key | description |
---|---|
::md/inline-schemas | support plumatic-style inline schemas (true) |
::md/sequential-maps | support sequential maps in non-rest position (true) |
::md/references | qualified schema references used (true) |
::md/required-keys | destructured keys are required (false) |
::md/closed-maps | destructured maps are closed (false) |
Examples:
(require '[malli.destructure :as md])
(-> '[a b & cs] (md/parse) :schema) ; => [:cat :any :any [:* :any]]
(-> '[a :- :string, b & cs :- [:* :int]] (md/parse) :schema) ; => [:cat :string :any [:* :int]]
Takes a destructuring bindings vector (arglist) and returns a map with keys: | key | description | | ---------------|-------------| | `:raw-arglist` | the original arglist (can have type-hints) | `:arglist` | simplified clojure arglist (no type-hints) | `:schema` | extracted malli schema | `:parsed` | full parse results Parsing can be configured using the following options: | key | description | | -----------------------|-------------| | `::md/inline-schemas` | support plumatic-style inline schemas (true) | `::md/sequential-maps` | support sequential maps in non-rest position (true) | `::md/references` | qualified schema references used (true) | `::md/required-keys` | destructured keys are required (false) | `::md/closed-maps` | destructured maps are closed (false) Examples: (require '[malli.destructure :as md]) (-> '[a b & cs] (md/parse) :schema) ; => [:cat :any :any [:* :any]] (-> '[a :- :string, b & cs :- [:* :int]] (md/parse) :schema) ; => [:cat :string :any [:* :int]]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close