clojure-spec 2024-10-15

Hi, is there a way with spec to define a map where one of the key depends on another, e.g. I define s/keys :req-un [::foo ::bar] , both keys are colls and ::bar depends on ::foo

You use a/and to add a predicate on the whole map that relates the keys. Almost always ends up requiring you write a custom generator

ok ok thank you

a/and or s/and ?

(essentially I'd generate ::bar by doing a reduce on ::foo )