Use retag function to allow generative testing of multi-spec whose
multimethod has a :default dispatch method.
(require '[clojure.spec.alpha :as s]
'[clojure.spec.gen.alpha :as gen])
(s/def ::tag #{:a :b :c :d})
(s/def ::example-key keyword?)
(s/def ::different-key keyword?)
(defmulti tagmm :tag)
(defmethod tagmm :a [_] (s/keys :req-un [::tag ::example-key]))
(defmethod tagmm :default [_] (s/keys :req-un [::tag ::different-key]))
(s/def ::example (s/multi-spec tagmm :tag))
(gen/sample (s/gen ::example))
;=> only get examples with :tag :a
(s/def ::example (s/multi-spec tagmm (fn retag [gen-v dispatch-tag] gen-v)))
(gen/sample (s/gen ::example))
;=> get examples with all :tag options