Fork me on GitHub

Is there an easy way to modify an existing s/keys spec? I often find myself needing to take an existing spec and update a few keys. It’d be nice if I could just replace a key instead of copying everything.


Maybe s/merge would work for you @xiongtx? I'm not quite sure how it handles merging over existing keys tho'


I managed to get around it by redefining the specs that differ


Is it possible to instrument initial function calls? i.e. I have my dev namespace where I enable instrumentation:

(ns dev.user
    [clojure.spec.test.alpha :as st]

But by the time I load my dev.user namespace, I have already ran some functions:
(ns my-project.util
    [clojure.spec.alpha :as s]))

(defn reg-event
  ;; do side effecting stuff

(s/fdef reg-event
        :args (s/cat :id keyword?)
        :ret nil?)

(reg-event "my-event")
The call to reg-event is not instrumented at this point so I do not get a instrumentation error that my call to reg-event is incorrect.


You could just (st/instrument reg-event) after it’s fdef?


True but that doesn't scale well and requires special considerations in production.