Fork me on GitHub

How would I use spec to specify an optional positional arg, but define the contents of that arg if it exists? Like, my current spec is:

(s/fdef set-http-probe :args (s/cat :deployment ::kube-deployment/deployment
                                    :kind #{:startup :liveness :readiness :default}
                                    :args (s/keys :opt-un [::kube/probe-kind ::kube/http-port ::kube/path ::kube/probe-args])))
but I actually want to not have to specify the args parameter at all. At the moment if there are no additional optional args to provide I have to call the function with an empty map at that location. I tried wrapping s/keys in s/nilable, but in that case I still had to provide an explicit nil final arg in my call


The answer to this was s/alt, which I've not come across before 🎉


I like to use it with ch/ips


Why is there no :groan: emoji?


You're a dad now Dan, get in on the joke action


Doing 2x s/cat (1 missing :args entirely) that are combined with a basic or doesn't seem to quite work either