Fork me on GitHub
#malli
<
2021-03-25
>
ikitommi18:03:00

first kinda BREAKING change in the public api. m/parse on :multi now returns the branch information. It’s a fix, but still:

(def Multi
  [:multi {:dispatch :type}
   [:user [:map [:size :int]]]
   [::m/default :any]])

(m/parse Multi {:type :user, :size 1})
; => [:user {:type :user, :size 1}]

(m/parse Multi {:type "sized", :size 1})
; => [:malli.core/default {:type "sized", :size 1}]

(->> {:type :user, :size 1}
     (m/parse Multi)
     (m/unparse Multi))
; => {:type :user, :size 1}

ikitommi22:03:47

+5 loc later (including comments): :and merges on first child! comments welcome on the results - https://github.com/metosin/malli/pull/405

genRaiy16:03:58

I thought it read 5k loc ... so 😅

genRaiy16:03:15

I have added a quick comment. Thanks for the feature

Yevgeni Tsodikov07:03:49

Awesome MR! Thanks 🙏

ikitommi10:03:07

merged in master