Fork me on GitHub

is there a way to use Malli to remove nil values in a map? :thinking_face:

Leonid Korogodski20:04:31

The oddest thing. I have two projects. Both use malli 0.2.1 (according to `lein deps :tree`). But one of them accepts the syntax `[:map [:a string?] [:b string?]]` just fine, while the other throws an error on `(restart)`:

data-spec collection [] should be homogeneous, 3 values found
Any idea what could be the cause?


@lkorogodski Can you try with lein clean and then run your project again?


You might have some left-overs in your target folder or something


@lkorogodski Please don't paste such long output into slack but rather use something like github gist


What happens when you do:

(require '[ :as io])
(io/resource "malli/core__init.class")


just checking if this isn't an AOT-related problem

Leonid Korogodski22:04:58

Ok, sorry. Just a moment.

Leonid Korogodski22:04:32

nREPL server started on port 64815 on host - 
Connecting to local nREPL server...
Clojure 1.10.3
(require '[ :as io])
=> nil
(io/resource "malli/core__init.class")
=> nil
(require '[malli.core :as m])
=> nil
(m/validator [:map [:a string?] [:b string?]])
That seems to work. But when I call (restart), it fails. The usage for the router is as follows:
["/my-route" {:get {:summary    "..."
                    :parameters {:header {:authorization string?}
                                 :query  [:map
                                           [:a string?]
                                           [:b string?]}
                    ;; other things

Leonid Korogodski22:04:59

map? works in place of [:map ...] but doesn't check enough, of course.