Skip to content

Commit

Permalink
0.21.0 is out!
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed May 25, 2015
1 parent 4269293 commit d0125bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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"]`
Expand Down Expand Up @@ -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"
```
Expand Down
37 changes: 1 addition & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]
Expand Down

0 comments on commit d0125bf

Please sign in to comment.