malli icon indicating copy to clipboard operation
malli copied to clipboard

Feature request: `var?` predicate in schemas

Open NoahTheDuke opened this issue 2 years ago • 0 comments

I have a map of keyword to function, and the functions are hash-quoted as vars so they can be reloaded at the repl:

(def example
 {:a #'a
  :b #'b})

I would like to write a schema for this (and other similar objects), but [:map-of keyword? var?] doesn't work because var? isn't a recognized predicate. Is this something you're interested in including?

Associated with that, I wonder if it would be possible to have validation of the derefed object too: [:map-of keyword? [:var fn?]] would check that the provided value is a Var and then deref it and check it's a function.

Thanks so much!

NoahTheDuke avatar Jul 28 '22 21:07 NoahTheDuke