Anyone able to help me understand why my path param isn’t being coerced to a int like i would expect? It also validate (complain) if the input can’t be coerced to an int.
(s/def ::id spec/int?)
(def app
(api
{:coercion :spec
:swagger
{:ui "/"
:spec "/swagger.json"
:data {:info {:title "ResoluteAPI"
:description "API endpoint around customer portfolios"}
:tags [{:name "Equipments", :description "A api for the equipments page"}]}}}
(context "/api" []
:tags ["api"]
(GET "/equipment/:equipment-id/points" []
:return ::points
:path-params [equipment-id :- ::id]
:summary "returns all points for a given equipment"
(ok {:hi equipment-id})))))
(-> {:uri "/api/equipment/3/points"
:request-method :get}
app
:body
slurp
(cheshire.core/parse-string true))
;;{:hi "3"}
updated the deps and everything works fine
how do I set an example request body in a compojure-api endpoint?
I have seen it before, but I can’t remember