Skip to content

Commit

Permalink
Merge master into url-decode-path-params
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Davidson committed Aug 5, 2018
2 parents f6054a7 + 282fa7f commit c81dad4
Show file tree
Hide file tree
Showing 57 changed files with 2,096 additions and 368 deletions.
51 changes: 50 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,55 @@
## UNRELEASED
## 0.2.0-SNAPSHOT

## `reitit-core`

* **BREAKING**: the router option key to extract body format has been renamed: `:extract-request-format` => `:reitit.coercion/extract-request-format`
* should only concern you if you are not using [Muuntaja](https://github.com/metosin/muuntaja).
* the `r/routes` returns just the path + data tuples as documented, not the compiled route results. To get the compiled results, use `r/compiled-routes` instead.
* new [faster](https://github.com/metosin/reitit/blob/master/perf-test/clj/reitit/impl_perf_test.clj) and more correct encoders and decoders for query & path params.
* query-parameters are encoded with `reitit.impl/form-encode`, so spaces are `+` instead of `%20`.
* correctly read `:header` params from request `:headers`, not `:header-params`
* welcome route name conflict resolution! If router has routes with same names, router can't be created. fix 'em.
* sequential child routes are allowed, enabling this:

```clj
(-> ["/api"
(for [i (range 4)]
[(str "/" i)])]
(r/router)
(r/routes))
;[["/api/0" {}]
; ["/api/1" {}]
; ["/api/2" {}]
; ["/api/3" {}]]
```

* A [Guide to compose routers](https://metosin.github.io/reitit/advanced/composing_routers.html)
* Welcome Middleware and Intercetor Registries!
* when Keywords are used in place of middleware / interceptor, a lookup is done into Router option `::middleware/registry` (or `::interceptor/registry`) with the key. Fails fast with missing registry entries.
* fixes [#32](https://github.com/metosin/reitit/issues/32).
* full documentation [here](https://metosin.github.io/reitit/ring/middleware_registry.html).

```clj
(require '[reitit.ring :as ring])
(require '[reitit.middleware :as middleware])

(defn wrap-bonus [handler value]
(fn [request]
(handler (update request :bonus (fnil + 0) value))))

(def app
(ring/ring-handler
(ring/router
["/api" {:middleware [[:bonus 20]]}
["/bonus" {:middleware [:bonus10]
:get (fn [{:keys [bonus]}]
{:status 200, :body {:bonus bonus}})}]]
{::middleware/registry {:bonus wrap-bonus
:bonus10 [:bonus 10]}})))

(app {:request-method :get, :uri "/api/bonus"})
; {:status 200, :body {:bonus 30}}
```

## `reitit-swagger`

Expand All @@ -26,6 +70,11 @@
(swagger-ui/create-swagger-ui-handler {:path "/"}))
```

## `reitit-middleware`

* A new module with common data-driven middleware: exception handling, content negotiation & multipart requests. See [the docs](https://metosin.github.io/reitit/ring/default_middleware.html).


## `reitit-swagger-ui`

* **BREAKING**: pass swagger-ui `:config` as-is (instead of mixed-casing keys) to swagger-ui, fixes [#109](https://github.com/metosin/reitit/issues/109):
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ See the [full documentation](https://metosin.github.io/reitit/) for details.
## Modules

* `reitit-core` - the routing core
* [`reitit-ring`](https://metosin.github.io/reitit/ring/ring.html) with [data-driven middleware](https://metosin.github.io/reitit/ring/data_driven_middleware.html)
* `reitit-ring` - a [ring router](https://metosin.github.io/reitit/ring/ring.html)
* `reitit-middleware` - [common data-driven middleware](https://metosin.github.io/reitit/ring/default_middleware.html) for `reitit-ring`
* `reitit-spec` [clojure.spec](https://clojure.org/about/spec) coercion
* `reitit-schema` [Schema](https://github.com/plumatic/schema) coercion
* `reitit-swagger` [Swagger2](https://swagger.io/) apidocs
* `reitit-swagger-ui` Integrated [Swagger UI](https://github.com/swagger-api/swagger-ui).
* `reitit-swagger-ui` Integrated [Swagger UI](https://github.com/swagger-api/swagger-ui)

Bubblin' under:

Expand All @@ -36,18 +37,18 @@ Bubblin' under:
All bundled:

```clj
[metosin/reitit "0.1.4-SNAPSHOT"]
[metosin/reitit "0.2.0-SNAPSHOT"]
```

Optionally, the parts can be required separately:

```clj
[metosin/reitit-core "0.1.4-SNAPSHOT"]
[metosin/reitit-ring "0.1.4-SNAPSHOT"]
[metosin/reitit-spec "0.1.4-SNAPSHOT"]
[metosin/reitit-schema "0.1.4-SNAPSHOT"]
[metosin/reitit-swagger "0.1.4-SNAPSHOT"]
[metosin/reitit-swagger-ui "0.1.4-SNAPSHOT"]
[metosin/reitit-core "0.2.0-SNAPSHOT"]
[metosin/reitit-ring "0.2.0-SNAPSHOT"]
[metosin/reitit-spec "0.2.0-SNAPSHOT"]
[metosin/reitit-schema "0.2.0-SNAPSHOT"]
[metosin/reitit-swagger "0.2.0-SNAPSHOT"]
[metosin/reitit-swagger-ui "0.2.0-SNAPSHOT"]
```

## Quick start
Expand Down
14 changes: 7 additions & 7 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ Modules:
To use Reitit, add the following dependency to your project:

```clj
[metosin/reitit "0.1.4-SNAPSHOT"]
[metosin/reitit "0.2.0-SNAPSHOT"]
```

Optionally, the parts can be required separately:

```clj
[metosin/reitit-core "0.1.4-SNAPSHOT"]
[metosin/reitit-ring "0.1.4-SNAPSHOT"]
[metosin/reitit-spec "0.1.4-SNAPSHOT"]
[metosin/reitit-schema "0.1.4-SNAPSHOT"]
[metosin/reitit-swagger "0.1.4-SNAPSHOT"]
[metosin/reitit-swagger-ui "0.1.4-SNAPSHOT"]
[metosin/reitit-core "0.2.0-SNAPSHOT"]
[metosin/reitit-ring "0.2.0-SNAPSHOT"]
[metosin/reitit-spec "0.2.0-SNAPSHOT"]
[metosin/reitit-schema "0.2.0-SNAPSHOT"]
[metosin/reitit-swagger "0.2.0-SNAPSHOT"]
[metosin/reitit-swagger-ui "0.2.0-SNAPSHOT"]
[metosin/frontend "0.1.4-SNAPSHOT"]
```

Expand Down
2 changes: 2 additions & 0 deletions doc/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* [Static Resources](ring/static.md)
* [Dynamic Extensions](ring/dynamic_extensions.md)
* [Data-driven Middleware](ring/data_driven_middleware.md)
* [Middleware Registry](ring/middleware_registry.md)
* [Default Middleware](ring/default_middleware.md)
* [Pluggable Coercion](ring/coercion.md)
* [Route Data Validation](ring/route_data_validation.md)
* [Compiling Middleware](ring/compiling_middleware.md)
Expand Down
Loading

0 comments on commit c81dad4

Please sign in to comment.