This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-12
Channels
- # aws (3)
- # beginners (28)
- # boot (3)
- # cider (28)
- # clara (5)
- # cljs-dev (107)
- # cljsrn (1)
- # clojure (40)
- # clojure-austin (2)
- # clojure-brasil (5)
- # clojure-canada (1)
- # clojure-italy (1)
- # clojure-spec (39)
- # clojure-uk (38)
- # clojurescript (33)
- # community-development (11)
- # cursive (11)
- # datomic (43)
- # duct (6)
- # emacs (7)
- # flambo (1)
- # fulcro (68)
- # graphql (11)
- # jobs (1)
- # jobs-discuss (8)
- # leiningen (16)
- # luminus (2)
- # lumo (1)
- # off-topic (38)
- # om (2)
- # onyx (15)
- # parinfer (32)
- # portkey (5)
- # re-frame (50)
- # reagent (50)
- # reitit (1)
- # shadow-cljs (63)
- # spacemacs (10)
- # sql (27)
- # unrepl (6)
- # yada (2)
swagger-feature
~looks like:
(def swagger-feature
"Feature for handling swagger-documentation for routes.
Works both with Middleware & Interceptors. Does not participate
in actual request processing, just provides specs for the extra
valid keys for the route data. Should be accompanied by a
[[swagger-spec-handler]] to expose the swagger spec.
Swagger-spesific keys:
| key | description |
| --------------|-------------|
| :swagger | map of any swagger-data. Must have `:id` to identify the api
The following common route keys also contribute to swagger spec:
| key | description |
| --------------|-------------|
| :no-doc | optional boolean to exclude endpoint from api docs
| :tags | optional set of strings of keywords tags for an endpoint api docs
| :summary | optional short string summary of an endpoint
| :description | optional long description of an endpoint. Supports
| :parameters | optional input parameters for a route, in a format defined by the coercion
| :responses | optional descriptions of responess, in a format defined by coercion
Example:
[\"/api\"
{:swagger {:id :my-api}
:middleware [reitit.swagger/swagger-feature]}
[\"/swagger.json\"
{:get {:no-doc true
:swagger {:info {:title \"my-api\"}}
:handler reitit.swagger/swagger-spec-handler}}]
[\"/plus\"
{:get {:tags #{:math}
:summary \"adds numbers together\"
:description \"takes `x` and `y` query-params and adds them together\"
:parameters {:query {:x int?, :y int?}}
:responses {200 {:body {:total pos-int?}}}
:handler (fn [{:keys [parameters]}]
{:status 200
:body (+ (-> parameters :query :x)
(-> parameters :query :y)})}}]]"
{:name ::swagger
:spec ::spec})