mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
malli 0.2.0, update docs & tune
This commit is contained in:
parent
b4d1b36c8d
commit
9ce7e6593c
5 changed files with 15 additions and 20 deletions
|
|
@ -17,13 +17,17 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino
|
|||
* updated deps:
|
||||
|
||||
```clj
|
||||
[metosin/malli "0.1.0"] is available but we use "0.0.1-20200924.063109-27"
|
||||
[metosin/malli "0.2.0"] is available but we use "0.0.1-20200924.063109-27"
|
||||
[com.fasterxml.jackson.core/jackson-core "2.11.3"] is available but we use "2.11.2"
|
||||
[com.fasterxml.jackson.core/jackson-databind "2.11.3"] is available but we use "2.11.2"
|
||||
[expound "0.8.6"] is available but we use "0.8.5"
|
||||
[ring/ring-core "1.8.2"] is available but we use "1.8.1"
|
||||
```
|
||||
|
||||
### `reitit-ring`
|
||||
|
||||
* Fix resource handler path matching [#443](https://github.com/metosin/reitit/pull/443)
|
||||
|
||||
## 0.5.6 (2020-09-26)
|
||||
|
||||
* updated deps:
|
||||
|
|
|
|||
|
|
@ -10,14 +10,7 @@
|
|||
(defn- stripped [x] (select-keys x [:enter :leave :error]))
|
||||
|
||||
(defn- publish-swagger-data? [{:keys [form body]}]
|
||||
(not (and (some? form)
|
||||
(nil? body))))
|
||||
|
||||
(defn- swagger-data [parameters muuntaja]
|
||||
(if (publish-swagger-data? parameters)
|
||||
{:data {:swagger {:produces (displace (m/encodes muuntaja))
|
||||
:consumes (displace (m/decodes muuntaja))}}}
|
||||
{}))
|
||||
(not (and (some? form) (nil? body))))
|
||||
|
||||
(defn format-interceptor
|
||||
"Interceptor for content-negotiation, request and response formatting.
|
||||
|
|
@ -48,7 +41,9 @@
|
|||
(if-let [muuntaja (or muuntaja default-muuntaja)]
|
||||
(merge
|
||||
(stripped (muuntaja.interceptor/format-interceptor muuntaja))
|
||||
(swagger-data parameters muuntaja))))}))
|
||||
(if (publish-swagger-data? parameters)
|
||||
{:data {:swagger {:produces (displace (m/encodes muuntaja))
|
||||
:consumes (displace (m/decodes muuntaja))}}}))))}))
|
||||
|
||||
(defn format-negotiate-interceptor
|
||||
"Interceptor for content-negotiation.
|
||||
|
|
|
|||
|
|
@ -9,14 +9,7 @@
|
|||
(defn- displace [x] (with-meta x {:displace true}))
|
||||
|
||||
(defn- publish-swagger-data? [{:keys [form body]}]
|
||||
(not (and (some? form)
|
||||
(nil? body))))
|
||||
|
||||
(defn- swagger-data [parameters muuntaja]
|
||||
(if (publish-swagger-data? parameters)
|
||||
{:data {:swagger {:produces (displace (m/encodes muuntaja))
|
||||
:consumes (displace (m/decodes muuntaja))}}}
|
||||
{}))
|
||||
(not (and (some? form) (nil? body))))
|
||||
|
||||
(def format-middleware
|
||||
"Middleware for content-negotiation, request and response formatting.
|
||||
|
|
@ -41,7 +34,9 @@
|
|||
:compile (fn [{:keys [muuntaja parameters]} _]
|
||||
(if muuntaja
|
||||
(merge
|
||||
(swagger-data parameters muuntaja)
|
||||
(if (publish-swagger-data? parameters)
|
||||
{:data {:swagger {:produces (displace (m/encodes muuntaja))
|
||||
:consumes (displace (m/decodes muuntaja))}}})
|
||||
{:wrap #(muuntaja.middleware/wrap-format % muuntaja)})))})
|
||||
|
||||
(def format-negotiate-middleware
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
[metosin/muuntaja "0.6.7"]
|
||||
[metosin/jsonista "0.2.7"]
|
||||
[metosin/sieppari "0.0.0-alpha13"]
|
||||
[metosin/malli "0.1.0"]
|
||||
[metosin/malli "0.2.0"]
|
||||
|
||||
;; https://clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111
|
||||
[com.fasterxml.jackson.core/jackson-core "2.11.3"]
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
(is (= #{"application/edn"}
|
||||
(produces path)
|
||||
(consumes path)))))
|
||||
|
||||
(testing "form parameters swagger-data"
|
||||
(let [path "/form-params"]
|
||||
(is (= #{}
|
||||
|
|
|
|||
Loading…
Reference in a new issue