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"}})
welcome! try :multi https://github.com/metosin/malli?tab=readme-ov-file#multi-schemas
Cool!
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]@itai https://github.com/metosin/malli?tab=readme-ov-file#distributive-schemas
[: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.
should not do it. Please share / report bug
Okay, will do. Thanks @ikitommi.
https://github.com/metosin/malli/issues/1149 Error report.