IMO it's best as a convention to add specs like (s/def :event.payload.add/action #{:add}). It might look surprising in the beginning. After all, it's already enforced by the multimethod mechanisms. But making that extra step prevents two issues:
the json schema is incapable of picking up the quirks of complex dispatch-fns of multimethods. So without it the resulting json schema would be incomplete.
whenever you need to use spec generators to create samples, the methods again won't pickup the logic without that extra step.
IMO it's best as a convention to add specs like
(s/def :event.payload.add/action #{:add})
. It might look surprising in the beginning. After all, it's already enforced by themultimethod
mechanisms. But making that extra step prevents two issues:dispatch-fn
s of multimethods. So without it the resulting json schema would be incomplete.