clojureswaggercompojure-api

Query Parameter description in ring-swagger


I'm using ring-swagger via compojure-api. I have a few query parameters and I'm struggling to find a way to add a description to a single query parameter. I can add the summary of the entire endpoint but that's not enough.

Is it possible to add a swagger description to a single query parameter using ring-swagger/compojure-api?


Solution

  • compojure.api.sweet/describe.

    For example:

    (GET "/hello" []
      :query-params [name :- (describe String "This is the swagger description for the parameter")]
      (ok {:message (str "Hello, " name)}))