Fork me on GitHub
#malli
<
2020-03-27
>
ikitommi12:03:39

in a project swapping plumatic into malli and I think there should be more built-in schemas for common thigns, strings and dates. Maybe something like:

[:string {:min 1, :max 10}]
[:int {:min 1, :max 10}]
[:date {:min "2012-04-23"}]
[:date-time {:min "2012-04-23 00:00:00", :format "yyyy-MM-dd HH:mm:ss"}] 

eskos13:03:29

Sounds good to me. Maybe some of those should be aliases for other more in-depth schemas, but it’ll help the users a lot if there’s a good collection of those available out of the box.

eskos13:03:53

…huh, even? and odd? are not in the predicate registry. I was about to mention how to something like [:range {:from 0 :to 10 :step 2}] would really be just [:and [:int {:min 0 :max 10}] [:even?]] and thought to check that. Sorry, my mind’s wandering 🙂

eskos13:03:48

Also pos? neg? seem to be missing. Are these left out on purpose or just forgotten?

ikitommi14:03:52

the initial set of predicates for taken from clojure.spec, those which have generators defined. no other reason, could be added.

eskos14:03:21

Righto 🙂