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

**URL:** https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653
**Category:** Your Projects and Libraries
**Tags:** clojure, clojurescript
**Created:** [October 8, 2020, 5:09pm UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653 "2020-10-08T17:09:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ikitommi](https://clojureverse.org/user_avatar/clojureverse.org/ikitommi/32/5797_2.png) [@ikitommi](https://clojureverse.org/u/ikitommi)
#### Post date: [October 8, 2020, 5:09pm UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653/1 "2020-10-08T17:09:50Z")

</div>

After a year in incubation, we are proud to present [Malli](https://github.com/metosin/malli), a new data validation and specification library for Clojure/Script! Big thanks to [Clojurists Together](https://www.clojuriststogether.org/) for helping to ship it out.

Introduction post: [https://www.metosin.fi/blog/malli/](https://www.metosin.fi/blog/malli/)

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

Coordinates:

- Github: [https://github.com/metosin/malli](https://github.com/metosin/malli)
- Clojars: [https://clojars.org/metosin/malli](https://clojars.org/metosin/malli)
- Playground: [https://malli.io/](https://malli.io/)
- Slack: [#malli](https://clojurians.slack.com/messages/malli/)

On behalf of [Metosin](https://www.metosin.fi/) and all contributors,

Tommi

---

<div class="post-metadata">

### Author: ![didibus](https://clojureverse.org/user_avatar/clojureverse.org/didibus/32/951_2.png) [@didibus](https://clojureverse.org/u/didibus)
#### Post date: [October 8, 2020, 5:31pm UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653/2 "2020-10-08T17:31:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ikitommi](https://clojureverse.org/user_avatar/clojureverse.org/ikitommi/32/5797_2.png) [@ikitommi](https://clojureverse.org/u/ikitommi)
#### Post date: [October 8, 2020, 7:45pm UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653/3 "2020-10-08T19:45:39Z")

</div>

Just data now. But all of [sequence schemas](https://github.com/metosin/malli/issues/180), [schema parsing](https://github.com/metosin/malli/issues/241) and [function schemas](https://github.com/metosin/malli/issues/125) are WIP.

Data generation works, leans on [test.check](https://github.com/clojure/test.check), no special utilities for generative testing currently.

Some screenshots of things to come:

- sequence schema internal impl, a fusion of [seqexp](https://github.com/cgrand/seqexp), [clojure.spec](https://clojure.org/about/spec) and [minimallist](https://github.com/green-coder/minimallist):

[![](https://user-images.githubusercontent.com/567532/92779756-02ca7000-f3ab-11ea-8e48-dbe29458ee67.png) ](https://user-images.githubusercontent.com/567532/92779756-02ca7000-f3ab-11ea-8e48-dbe29458ee67.png)

- demo of malli + [plumatic schema](https://github.com/plumatic/schema) style `defn`, integrated into [cursive](https://github.com/clojure/test.check) and [clj-kondo](https://github.com/borkdude/clj-kondo), demo’ed on ClojureD:

[![](https://user-images.githubusercontent.com/567532/88691145-24c2a880-d105-11ea-8531-488caa16cf7a.jpeg) ](https://user-images.githubusercontent.com/567532/88691145-24c2a880-d105-11ea-8531-488caa16cf7a.jpeg)

---

<div class="post-metadata">

### Author: ![magnus0re](https://clojureverse.org/user_avatar/clojureverse.org/magnus0re/32/2593_2.png) [@magnus0re](https://clojureverse.org/u/magnus0re)
#### Post date: [October 17, 2020, 7:14am UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653/4 "2020-10-17T07:14:56Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![ikitommi](https://clojureverse.org/user_avatar/clojureverse.org/ikitommi/32/5797_2.png) [@ikitommi](https://clojureverse.org/u/ikitommi)
#### Post date: [October 19, 2020, 6:08am UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653/5 "2020-10-19T06:08:13Z")

</div>

`[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](https://spec.openapis.org/oas/v3.0.3#models-with-polymorphism-support) playable in [malli.io](http://malli.io) (click `Pet`).

```auto
[:schema {:registry {"Pet" [:map
                            [:type string?]
                            [:name string?]]
                     "Cat" [:merge
                            "Pet"
                            [:map
                             [:type [:= "Cat"]]
                             [:huntingSkill [:enum {:description "The measured skill for hunting"}
                                             :clueless, :lazy, :adventurous, :aggressive]]]]
                     "Dog" [:merge
                            "Pet"
                            [:map
                             [: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`](https://github.com/metosin/reitit) is also now compatible with the non-alpha malli.

See the full [CHANGELOG](https://github.com/metosin/malli/blob/master/CHANGELOG.md#020-2020-10-18) for details.

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [April 19, 2021, 6:08pm UTC](https://clojureverse.org/t/introducing-malli-a-new-data-validation-and-specification-library-for-clojure-script/6653/6 "2021-04-19T18:08:15Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
