This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-08
Channels
- # aleph (1)
- # architecture (4)
- # aws (5)
- # beginners (105)
- # boot (1)
- # boot-dev (72)
- # cider (5)
- # clara (15)
- # cljs-dev (51)
- # cljsrn (5)
- # clojure (155)
- # clojure-austin (3)
- # clojure-dusseldorf (2)
- # clojure-finland (1)
- # clojure-greece (37)
- # clojure-italy (17)
- # clojure-nl (1)
- # clojure-russia (6)
- # clojure-spec (23)
- # clojure-uk (6)
- # clojurescript (7)
- # community-development (1)
- # css (10)
- # cursive (15)
- # datomic (45)
- # defnpodcast (1)
- # duct (97)
- # emacs (5)
- # fulcro (46)
- # hoplon (8)
- # instaparse (25)
- # keechma (11)
- # leiningen (16)
- # off-topic (2)
- # onyx (9)
- # planck (2)
- # re-frame (5)
- # reagent (3)
- # reitit (2)
- # ring (6)
- # shadow-cljs (35)
- # spacemacs (9)
- # specter (9)
- # sql (18)
- # uncomplicate (4)
Middleware that just defines extra keys that can be present in a route data, with zero runtime penalty:
(def swagger-middleware
"Middleware for handling swagger-documentation for routes.
Does not participate in request processing, just provides new
valid keys for the route data:
Swagger-spesific keys:
| key | description |
| --------------|-------------|
| ::name | keyword name for the swagger-api set.
| ::info | swagger info map
The following common route keys also contribute to swagger spec:
| key | description |
| --------------|-------------|
| :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
| :no-doc | optional boolean to exclude endpoint from api docs
| :tags | optional set of strings of keywords tags for an endpoint api docs
Example:
[\"/api\"
{::swagger/name :my-api
:middleware [swagger/swagger-middleware]}
[\"/swagger.json\"
{:no-doc true
::swagger/info {:title \"my-api\"}
:handler 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 int?}}}
:handler ...}}]]"
{:name ::swagger
:spec ::swagger})