malli 2024-12-12

hey all, new to malli what's the best way to write / express the following:

(def ProductDepotAction [:or
                         [:map
                          [:type [:enum :add]]
                          [:data #'AddProduct]]
                         [:map
                          [:type [:enum :edit]]
                          [:data #'EditProduct]]
                         [:map
                          [:type [:enum :remove]]
                          [:data #'RemoveProduct]]])

(m/validate ProductDepotAction {:type :add
                                :data {:id "1"
                                       :name "cookie"
                                       :price 20.0
                                       :seller-id "2"}})

how can i flatten my map and use the previous defined structures (like merge)?

(def AddProduct [:map
                 [:id :string]
                 [:name :string]
                 [:description {:optional true} :string]
                 [:price :double]
                 [:seller-id :string]])

(def ProductDepotAction [:multi {:dispatch :action}
                         [:add [:map
                                [:action :keyword]
                                [:data #'AddProduct]]]])
[:map [:action :keyword] #'AddProduct]

[:merge [:map COMMON] [:multi DIFFERENCES]]

Hi folks, I have some schemas that will cause the error pretty printer to stack overflow. Whats the best way to debug this? Or is there a way to prevent the error pretty printer from throwing this stack overflow.