Fork me on GitHub
#malli
<
2021-05-14
>
Adam Helins10:05:12

(I opened an issue since it looks like it's worth having a discussion: https://github.com/metosin/malli/issues/448)

Adam Helins11:05:58

Did you consider a :multi variant where the function directly returns a schema as opposed to a mere dispatch value? Like Spec does, actually. Once in a while I have to write something like:

[:multi {:dispatch first} [::a ::a] [::b ::b] [::c ::c] ...]

snorremd15:05:44

Hi. Is there a built in story for validating and coercing Record types? Using [:map [:fieldA :int] [:fieldB :int]] fails when Malli tries to humanise an error and calls the empty function in Clojure core on the record causing an error. Not sure if using the map schema is the correct way of going about this at all, or if it would be better to create a (malli.core/-simple-schema) or something. Any pointers would be appreciated.

nilern10:05:43

I think :map matches the defrecord philosophy so the error you are getting would be a bug in error humanization. Humanization is not a fundamental operation so making records work should not be a big deal.

Ivan Fedorov18:05:34

I’ve gathered some observations about walking malli schemas to transform them into something (eql vector, clojure spec alpha). Critique and additions welcome https://github.com/dvingo/malli-code-gen/blob/main/src/dev/space/matterandvoid/transform_building_ideas.cljc If anyone experienced with malli has 30 minutes – let’s record a youtube video together on writing malli code transformations. I think, this should be valuable for those who want to write their own transformers and consequently the community.