You could always extract specific keys from the payload and validate that,
something like:
(GET "/..." req
(let [b (:body req)
data {:my/result (:resultCount b)
:my/other-key (get-in b [:some :path])}]
(my-business-logic data)))
i.e. spec what your code
Yes, the namespacing is great, so I have no issue with that. I would just
rather use snake-case in Clojure than camel-case. Since the payload has
'resultCount' I'd like to map that to a spec named result-count instead.
I think I figured out part of the answer:
(s/def :my/result int?)
(s/def
Avoiding global name collision is the reason why specs are named with
namespace-qualified keywords. I am confused by your last sentence though.
Do you mean Clojure namespaces or the namespace component of the keyword
itself? There is no requirement in clojure.spec that the namespace of the
I have one spec question covering two scenarios.
1. Suppose I want to spec a payload from a third-party API that has the
keyword ':resultCount' in it. Does that mean my specs for that item must
have the same name?
2. Supposed I have a few payloads from that API and each has a keyword