From d0125bf44b4c83dfb15809a811ffeee5e83f78d2 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Mon, 25 May 2015 16:18:19 +0300 Subject: [PATCH] 0.21.0 is out! --- CHANGELOG.md | 4 +++- README.md | 37 +------------------------------------ project.clj | 2 +- 3 files changed, 5 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90ad1bb6..3fd9d2ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.21.0 +## 0.21.0 (25.5.2015) * `:multipart-params` now sets `:consumes ["multipart/form-data"]` and `:form-params` sets `:consumes ["application/x-www-form-urlencoded"]` @@ -68,7 +68,9 @@ * updated dependencies: ```clojure +[metosin/ring-swagger "0.20.4"] is available but we use "0.20.3" [metosin/ring-http-response "0.6.2"] is available but we use "0.6.1" +[metosin/ring-swagger-ui "2.1.5-M2"] [prismatic/plumbing "0.4.4"] is available but we use "0.4.3" [prismatic/schema "0.4.3"] is available but we use "0.4.2" ``` diff --git a/README.md b/README.md index b53406cc..01288e17 100644 --- a/README.md +++ b/README.md @@ -518,42 +518,7 @@ app supports), opposed to the [Ring Spec](https://github.com/mmcgrana/ring/blob/ (ok (str "hello, " name)))) ``` -## Response-models (pre 0.21.0) - -Key `:responses` takes a map of http-status-code -> model map, which translates to both return model coercion and -to swagger `responseMessages` description. Models can be decorated with `:message` meta-data. - -```clojure -(GET* "/" [] - :query-params [return :- (s/enum :200 :403 :404)] - :responses {403 (with-meta {:code s/Str} {:message "spiders?"}) - 404 (with-meta {:reason s/Str} {:message "lost?"})} - :return Total - :summary "multiple returns models" - (case return - :200 (ok {:total 42}) - :403 (forbidden {:code "forest"}) - :404 (not-found {:reason "lost"}))) -``` - -The `:return` maps the model just to the response 200, so one can also say: - -```clojure -(GET* "/" [] - :query-params [return :- (s/enum :200 :403 :404)] - :responses {200 (with-meta Total {:message "happy path"}) - 403 (with-meta {:code s/Str} {:message "spiders?"}) - 404 (with-meta {:reason s/Str} {:message "lost?"})} - :summary "multiple returns models" - (case return - :200 (ok {:total 42}) - :403 (forbidden {:code "forest"}) - :404 (not-found {:reason "lost"}))) -``` - -## Response-models (post 0.21.0) - -This stuff works with `0.21.0-SNAPSHOT`. +## Response-models Key `:responses` takes a map of http-status-code to schema-definitions map (with optional `:schema`, `:description` and `:headers` keys). `:schema` defines the return model diff --git a/project.clj b/project.clj index fba9e982..f71684e3 100644 --- a/project.clj +++ b/project.clj @@ -13,7 +13,7 @@ [prismatic/schema "0.4.3"] [org.tobereplaced/lettercase "1.0.0"] [metosin/ring-http-response "0.6.2"] - [metosin/ring-swagger "0.20.4-SNAPSHOT"] + [metosin/ring-swagger "0.20.4"] [metosin/ring-middleware-format "0.6.0"] [backtick "0.3.2"] [metosin/ring-swagger-ui "2.1.5-M2"]]