Introducing Malli, a new data validation and specification library for Clojure/Script

After a year in incubation, we are proud to present Malli, a new data validation and specification library for Clojure/Script! Big thanks to Clojurists Together for helping to ship it out.

Introduction post:

In short, Malli covers:

  • schema definitions, as data
  • support for open and closed maps
  • data validation and error reporting
  • humanised and localised error messages
  • spell-checking of map and multi keys
  • bi-directional value transformation
  • value and schema generation
  • tools for programming with schemas
  • immutable, mutable, dynamic, lazy and composite registries
  • support for JSON Schema, Swagger and DOT
  • open apis for both end users and extenders


On behalf of Metosin and all contributors,



Looking great, just a few questions:

Can Malli spec functions and macros as well? Or just data?

Also, is there any support for data generation and generative testing?

Just data now. But all of sequence schemas, schema parsing and function schemas are WIP.

Data generation works, leans on test.check, no special utilities for generative testing currently.

Some screenshots of things to come:


Been waiting for Malli to come out publically for a while now. It looks great!
I like that the project promises a migration path if ever it would be needed :slight_smile:

[metosin/malli "0.2.0"] is out. This version adds the following:

  • improved handling of schema references: conditional walking, generators, JSON and Swagger Schemas
  • BREAKING (MINOR): map-utilities in malli.util automatically deref the top-level schemas
  • optional schema transformation schemas: :merge, :union and :select-keys
  • new options for explicitly configuring or disabling sci
  • support microsecond precision when parsing datetime strings
  • OpenAPI 3.0.3 polymorphism example playable in (click Pet).
[:schema {:registry {"Pet" [:map
                            [:type string?]
                            [:name string?]]
                     "Cat" [:merge
                             [:type [:= "Cat"]]
                             [:huntingSkill [:enum {:description "The measured skill for hunting"}
                                             :clueless, :lazy, :adventurous, :aggressive]]]]
                     "Dog" [:merge
                             [:type [:= "Dog"]]
                             [:packSize [:int {:min 0,
                                               :default 0
                                               :description "the size of the pack the dog is from"}]]]]}}
 [:multi {:dispatch :type} "Cat" "Dog"]]

Latest metosin/reitit is also now compatible with the non-alpha malli.

See the full CHANGELOG for details.

1 Like