hey, is there a way to reuse the same spec for different map keys without having to redefine them over and over?
(s/def ::address (some-pred-to-check-ethereum-addr))
(s/def ::tx (s/keys :req-un [:sender ::address ;; apply address spec to :sender
:recipient ::address])) ;; apply address spec to :recipient
In short, no
@wcalderipe you can do this:
(def spec (s/....)
(s/def ::a spec)
(s/def ::b spec)
Note sure if that also works in spec2 - I completely lost track of that
No, it won’t like that but you could set it quoted and make it work via s/register
But I don’t think that works the way it’s requested with req-un in either case
thanks @alexmiller and @borkdude
I think select might work better here right in spec2?
s/keys
is the best way to check the shape of a map?
Yes, but will still have repetition
For stuff like above, yes