Skip to content

Commit be25179

Browse files
committed
Update Changelog & README
1 parent 806c9cb commit be25179

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,26 @@
4646
* `context*` => `context`
4747
* `defroutes*` => `defroutes`
4848

49-
* **BREAKING** `public-resource-routes` & `public-resources` are removed from `compojure.api.middleware`.
49+
* **BREAKING** `swagger-docs` and `swagger-ui` are now longer in `compojure.api.sweet`
50+
* Syntax was hairy and when configuring the spec-url it needed to be set to both in order to work
51+
* In future, there are multiple ways of setting the swagger stuff:
52+
* via api-options `:swagger` (has no defaults)
53+
* via `swagger-routes` function, mounting both the `swagger-ui` and `swagger-docs` and wiring them together
54+
* by default, mounts the swagger-ui to `/` and the swagger-spec to `/swagger.json`
55+
* via the old `swagger-ui` & `swagger-docs` (need to be separately imported from `compojure.api.swagger`).
56+
* see https://github.com/metosin/compojure-api/wiki/Swagger-integration for details
57+
58+
```clj
59+
(defapi app
60+
(swagger-routes)
61+
(GET "/ping" []
62+
(ok {:message "pong"})))
63+
64+
(defapi app
65+
{:swagger {:ui "/", :spec "/swagger.json"}}
66+
(GET "/ping" []
67+
(ok {:message "pong"})))
68+
```
5069

5170
* **BREAKING**: api-level coercion option is now a function of `request => type => matcher` as it is documented.
5271
Previously required a `type => matcher` map. Options are checked against `type => matcher` coercion input, and a
@@ -70,6 +89,8 @@ take a vector of middleware containing either
7089
has been renamed to `:swagger`.
7190
* will break at macro-expansion time with helpful exception
7291

92+
* **BREAKING** `public-resource-routes` & `public-resources` are removed from `compojure.api.middleware`.
93+
7394
* **BREAKING**: `compojure.api.legacy` namespace has been removed.
7495

7596
### Migration guide
@@ -84,8 +105,6 @@ https://github.com/metosin/compojure-api/wiki/Migration-Guide-to-1.0.0
84105

85106
* top-level `api` is now just function, not a macro. It takes an optional options maps and a top-level route function.
86107

87-
* `swagger-docs` and `swagger-ui` are now functions instead of macros.
88-
89108
* Coercer cache is now at api-level with 10000 entries.
90109

91110
* Code generated from restructured route macros is much cleaner now

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ Stuff on top of [Compojure](https://github.com/weavejester/compojure) for making
5252
:city s/Str}})
5353

5454
(defapi app
55-
(swagger-ui)
56-
(swagger-docs
57-
{:info {:title "My Swagger API"
58-
:description "Compojure Api example"}
59-
:tags [{:name "api", :description "sample api"}]})
55+
{:swagger {:spec "/swagger.json"
56+
:ui "/api-docs"
57+
:data {:data {:info {:title "My Swagger API"
58+
:description "Compojure Api example"}
59+
:tags [{:name "api", :description "sample api"}]}})
6060
(context "/api" []
6161
:tags ["api"]
6262
(GET "/hello" []

0 commit comments

Comments
 (0)