Fork me on GitHub
Asko Nōmm19:08:50

Hi! I found a interesting issue in CLJS where Malli fails with "Invalid schema" when checking for object? , for example:

(m/validate [:or map? object?] input)
Fails. However whenever I remove the object?, it starts working. How do I validate a JS object with Malli if object? makes Malli fail?


only certain predicates are "built in" - i.e. have an implicit mapping to something. map? gets swapped with [:map], effectively


if you want to use a custom predicate you can either use [:fn object?] - which won't have generation semantics if you use that for your project


there is also a way to make a custom schema key/generator/etc. I just don't know it offhand


it is documented here though

Asko Nōmm20:08:17

Cheers @U3JH98J4R, this solved it perfectly. I didn't know that it swapped the predicates, this makes sense now!