From dd4b9c3d9b71cb40ed3c660942a03378fee04bf9 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 28 Mar 2015 15:49:41 +0200 Subject: [PATCH] update docs, bump up version --- CHANGELOG.md | 6 +++--- README.md | 18 +++++++++++++++--- project.clj | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36afe765..eedc96e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index d4285fb0..c12def57 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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`. @@ -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)))) ``` diff --git a/project.clj b/project.clj index 15b82609..398cd629 100644 --- a/project.clj +++ b/project.clj @@ -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"