Liking cljdoc? Tell your friends :D

typed.clj.malli

Public API for typed ops in malli.core.

In general these operations:

  • are macros instead of functions
  • take Typed Clojure types instead of malli schemas
  • helps the type checker infer their results

See also:

  • typed.clj.malli.generator
  • typed.clj.malli.swagger
  • typed.clj.malli.json-schema
Public API for typed ops in `malli.core`.

In general these operations:
- are macros instead of functions
- take Typed Clojure types instead of malli schemas
- helps the type checker infer their results

See also:
- typed.clj.malli.generator
- typed.clj.malli.swagger
- typed.clj.malli.json-schema
raw docstring

-instrumentcljmacro

(-instrument tmap & args)

=>cljmacro

(=> name t)

defparsercljmacro

(defparser name t)

Def parser for Typed Clojure type t. Type checker infers the type of the return value when used.

eg., (defparser AnyInteger-parser t/AnyInteger) (AnyInteger-parser 1) ;=> 1 (AnyInteger-parser nil) ;=> :malli.core/invalid

Def parser for Typed Clojure type t. Type checker infers
the type of the return value when used.

eg.,
  (defparser AnyInteger-parser t/AnyInteger)
  (AnyInteger-parser 1) ;=> 1
  (AnyInteger-parser nil) ;=> :malli.core/invalid
raw docstring

defunparsercljmacro

(defunparser name t)

defvalidatorcljmacro

(defvalidator name t)

Def validator called name for type t. Type checker infers as a predicate on t.

eg., (defvalidator AnyInteger? t/AnyInteger) (AnyInteger? 1) => true (AnyInteger? nil) => false

Def validator called name for type t. Type checker infers as a predicate
on t.

eg.,
  (defvalidator AnyInteger? t/AnyInteger)
  (AnyInteger? 1) => true
  (AnyInteger? nil) => false
raw docstring

explaincljmacro

(explain t v)

Explain validation failure of v conforming to type t. Type checker infers as a predicate on "not t".

(explain t/AnyInteger 1) => nil (explain t/AnyInteger nil) => {:schema :int, :value nil, :errors ({:path [], :in [], :schema :int, :value nil, :type nil, :message nil})}

Explain validation failure of v conforming to type t. Type checker infers as a predicate
on "not t".

(explain t/AnyInteger 1) => nil
(explain t/AnyInteger nil)
=>
{:schema :int,
 :value nil,
 :errors
 ({:path [],
   :in [],
   :schema :int,
   :value nil,
   :type nil,
   :message nil})}
raw docstring

parsecljmacro

(parse t v)

Parse value v as type t. Type checker infers the shape of return value.

eg., (parse t/AnyInteger 1) ;=> 1 (parse t/AnyInteger nil) ;=> :malli.core/invalid (parse (t/U ^{::name :int} t/AnyInteger ^{::name :bool} t/Bool) 1) ;=> [:int 1] (parse (t/U ^{::name :int} t/AnyInteger ^{::name :bool} t/Bool) true) ;=> [:bool true]

Parse value v as type t. Type checker infers the shape of
return value.

eg.,
  (parse t/AnyInteger 1) ;=> 1
  (parse t/AnyInteger nil) ;=> :malli.core/invalid
  (parse (t/U ^{::name :int} t/AnyInteger
              ^{::name :bool} t/Bool)
         1)
  ;=> [:int 1]
  (parse (t/U ^{::name :int} t/AnyInteger
              ^{::name :bool} t/Bool)
         true)
  ;=> [:bool true]
raw docstring

parsercljmacro

(parser t)

Create parser for Typed Clojure type t. Type checker infers the type of the return value when used.

eg., ((parser t/AnyInteger) 1) ;=> 1 ((parser t/AnyInteger) nil) ;=> :malli.core/invalid ((parser (t/U ^{::name :int} t/AnyInteger ^{::name :bool} t/Bool)) 1) ;=> [:int 1] ((parser (t/U ^{::name :int} t/AnyInteger ^{::name :bool} t/Bool)) true) ;=> [:bool true]

Create parser for Typed Clojure type t. Type checker infers
the type of the return value when used.

eg.,
  ((parser t/AnyInteger) 1) ;=> 1
  ((parser t/AnyInteger) nil) ;=> :malli.core/invalid
  ((parser (t/U ^{::name :int} t/AnyInteger
                ^{::name :bool} t/Bool))
   1)
  ;=> [:int 1]
  ((parser (t/U ^{::name :int} t/AnyInteger
                ^{::name :bool} t/Bool))
   true)
  ;=> [:bool true]
raw docstring

unparsecljmacro

(unparse t v)

unparsercljmacro

(unparser t)

validatecljmacro

(validate t v)

Validate v as type t. Type checker infers as a predicate on t.

eg., (validate t/AnyInteger 1) => true (validate t/AnyInteger nil) => false

Validate v as type t. Type checker infers as a predicate
on t.

eg.,
  (validate t/AnyInteger 1) => true
  (validate t/AnyInteger nil) => false
raw docstring

validatorcljmacro

(validator t)

Create validator for type t. Type checker infers as a predicate on t.

eg., ((validator t/AnyInteger) 1) => true ((validator t/AnyInteger) nil) => false

Create validator for type t. Type checker infers as a predicate
on t.

eg.,
  ((validator t/AnyInteger) 1) => true
  ((validator t/AnyInteger) nil) => false
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close