Re: spec key aliasing or different specs for same keyword

2017-12-29 Thread Gary Verhaegen
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

Re: spec key aliasing or different specs for same keyword

2017-12-28 Thread Jonathon McKitrick
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

Re: spec key aliasing or different specs for same keyword

2017-12-28 Thread adrian . medina
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

spec key aliasing or different specs for same keyword

2017-12-28 Thread Jonathon McKitrick
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