mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
Changelog for reitit-swagger
This commit is contained in:
parent
97a00f57f1
commit
20c54b1d7b
1 changed files with 45 additions and 0 deletions
45
CHANGELOG.md
45
CHANGELOG.md
|
|
@ -19,6 +19,51 @@
|
|||
; :path "/coffee/luwa"}
|
||||
```
|
||||
|
||||
### `reitit-swagger`
|
||||
|
||||
* New module to produce swagger-docs from routing tree, including `Coercion` definitions. Works with both middleware & interceptors.
|
||||
|
||||
```clj
|
||||
(require '[reitit.ring :as ring])
|
||||
(require '[reitit.swagger :as swagger])
|
||||
(require '[reitit.ring.coercion :as rrc])
|
||||
(require '[reitit.coercion.spec :as spec])
|
||||
(require '[reitit.coercion.schema :as schema])
|
||||
|
||||
(require '[schema.core :refer [Int]])
|
||||
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
["/api"
|
||||
{:swagger {:id ::math}}
|
||||
|
||||
["/swagger.json"
|
||||
{:get {:no-doc true
|
||||
:swagger {:info {:title "my-api"}}
|
||||
:handler swagger/swagger-spec-handler}}]
|
||||
|
||||
["/spec" {:coercion spec/coercion}
|
||||
["/plus"
|
||||
{:get {:summary "plus"
|
||||
:parameters {:query {:x int?, :y int?}}
|
||||
:responses {200 {:body {:total int?}}}
|
||||
:handler (fn [{{{:keys [x y]} :query} :parameters}]
|
||||
{:status 200, :body {:total (+ x y)}})}}]]
|
||||
|
||||
["/schema" {:coercion schema/coercion}
|
||||
["/plus"
|
||||
{:get {:summary "plus"
|
||||
:parameters {:query {:x Int, :y Int}}
|
||||
:responses {200 {:body {:total Int}}}
|
||||
:handler (fn [{{{:keys [x y]} :query} :parameters}]
|
||||
{:status 200, :body {:total (+ x y)}})}}]]]
|
||||
|
||||
{:data {:middleware [rrc/coerce-exceptions-middleware
|
||||
rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware
|
||||
swagger/swagger-feature]}}))
|
||||
```
|
||||
|
||||
## 0.1.0 (2018-2-19)
|
||||
|
||||
* First release
|
||||
|
|
|
|||
Loading…
Reference in a new issue