Fork me on GitHub
#malli
<
2021-07-22
>
David Levinov12:07:54

Hey guys, very quick and simple question, I want to combine two schemas to validate for case a and case b, and I’d rather not involve regexes, and have one of the validation schemas to have the values not be of a certain set. How would I rewrite this in a correct manner?

(def NotABC
  (m/schema
    [:map
     [:field [:not [:enum "a" "b" "c"]]]]))
Thanks!

ikitommi15:07:13

looks legit to me.

David Levinov15:07:48

@ikitommi that’s exactly what I thought as well, but in the REPL:

Execution error (ExceptionInfo) at malli.core/-fail! (core.cljc:79).
:malli.core/invalid-schema {:schema :not}
thanks for the response 👌

ikitommi15:07:03

oh, what. Try updating the malli dependency.

🙌 2
David Levinov16:07:30

welp, that does indeed solve the issue, thanks haha

Lucy Wang14:07:32

@ikitommi Looks like the new function instrumentation only works for clj, but not for cljs yet. E.g. mi/instrument! and dev/start would throw when I use them in cljs. Is there any plan to add cljs support?

ikitommi14:07:19

@wxitb2017 help most welcome on cljs-support.

Ben Sless19:07:31

Initial attempt at writing a malli based parser for EDN datalog syntax https://gist.github.com/bsless/632b4040a2b2ad7469369f52cd610c06 Can't figure out why ::clause breaks and it's getting late here. Feel free to poke at the code, suggest improvements, feedback, etc.

Ben Sless14:07:39

Direct translation to spec works for parsing the forms, insights as to why it didn't work with malli most welcome, updated the gist