Skip to content

Commit

Permalink
update docs, bump up version
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Mar 28, 2015
1 parent b522be2 commit dd4b9c3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## 0.19.0-SNAPSHOT (xx.3.2015)
## 0.19.0 (28.3.2015)

- added destructuring for `:headers`, thanks to [tchagnon](https://github.com/tchagnon)!
- **BREAKING**: `:path-param` doesn't use force models to be strict, needed for the `context*
- **BREAKING**: parameters are collected in (Ring-)Swagger 2.0 format, might break client-side restructurings. see https://github.com/metosin/ring-swagger/blob/master/test/ring/swagger/swagger2_test.clj
- `:path-param` doesn't use force models to be strict, needed for the partial parameter matching in `context*`
- **BREAKING**: parameters are collected in (Ring-)Swagger 2.0 format, might break client-side restructurings. see https://github.com/metosin/ring-swagger/blob/master/test/ring/swagger/swagger2_test.clj & https://github.com/metosin/compojure-api/blob/master/src/compojure/api/meta.clj for examples of the new models
- `context*` to allow setting meta-data to mid-routes. Mid-route meta-data are deep-merged into endpoint swagger-definitions at compile-time. At runtime, code is executed in place.

```clojure
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,19 @@ Stuff on top of [Compojure](https://github.com/weavejester/compojure) for making
:return Thingie
:body [thingie Thingie]
:summary "echoes a Thingie from json-body"
(ok thingie)))))
(ok thingie))

(swaggered "context*"
:description "context* routes"
(context* "/context/:kikka" []
:summary "summary inherited from context"
:path-params [kikka :- s/Str]
:query-params [kukka :- s/Str]
(GET* "/:kakka" []
:path-params [kakka :- s/Str]
(ok {:kikka kikka
:kukka kukka
:kakka kakka})))))))
```

To try it yourself, clone this repository and type
Expand Down Expand Up @@ -172,7 +184,7 @@ supported content-type into request under keys `[:meta :consumes]` and `[:meta :

## Routes

You can use [vanilla Compojure routes](https://github.com/weavejester/compojure/wiki) or their enhanced versions from `compojure.api.core`. Enhanced versions have `*` in their name (`GET*`, `POST*`, `defroutes*` etc.) so that they don't get mixed up with the originals. Enhanced version can be used exactly as their ancestors but have also new behavior, more on that later.
You can use [vanilla Compojure routes](https://github.com/weavejester/compojure/wiki) or their enhanced versions from `compojure.api.core`. Enhanced versions have `*` in their name (`GET*`, `POST*`, `context*`, `defroutes*` etc.) so that they don't get mixed up with the originals. Enhanced version can be used exactly as their ancestors but have also new behavior, more on that later.

Namespace `compojure.api.sweet` is a public entry point for all routing - importing Vars from `compojure.api.core`, `compojure.api.swagger` and `compojure.core`.

Expand All @@ -186,7 +198,7 @@ There is also `compojure.api.legacy` namespace which contains rest of the public
[compojure.api.sweet :refer :all]))

(defapi app
(context "/api" []
(context* "/api" []
(GET* "/user/:id" [id] (ok {:id id}))
(POST* "/echo" {body :body-params} (ok body))))
```
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject metosin/compojure-api "0.19.0-SNAPSHOT"
(defproject metosin/compojure-api "0.19.0"
:description "Compojure Api"
:url "https://github.com/metosin/compojure-api"
:license {:name "Eclipse Public License"
Expand Down

0 comments on commit dd4b9c3

Please sign in to comment.