Fork me on GitHub
#malli
<
2022-01-27
>
Noah Bogart19:01:51

I have a map that contains function values, but I want to use a Var (`#'function-name`) to facilitate repl-driven development, however fn? doesn’t consider the Var a function and malli doesn’t recognize var? as a schema function

Ben Sless20:01:56

You want to validate the map itself?

Noah Bogart20:01:45

I have the validation for the map, but i’m realizing I need to be able to say [:or fn? var?] instead of just fn?

Ben Sless20:01:58

You can use a decoder

Ben Sless20:01:10

And deref the values :)

Ben Sless20:01:14

I.e. [:map [:k [fn? {:decode/var deref}]]]

Ben Sless20:01:18

Approximately

Noah Bogart20:01:53

huh interesting. i’ll give that a shot! thanks

Ben Sless20:01:04

Cheers. Make sure to wrap that deref in a try catch

Ben Sless20:01:59

But, why are you validating a map of functions? Especially w/o function schema it isn't very informative, is it?

Noah Bogart18:01:34

just barebones checking that i’m creating the right types, not doing much more than that to start

Noah Bogart19:01:07

any way to handle this?