mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
update deps
This commit is contained in:
parent
48e0c7f883
commit
fbff819909
6 changed files with 49 additions and 35 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,3 +13,4 @@ pom.xml.asc
|
|||
/_book
|
||||
figwheel_server.log
|
||||
/.idea
|
||||
.clj-kondo
|
||||
24
CHANGELOG.md
24
CHANGELOG.md
|
|
@ -12,6 +12,30 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino
|
|||
|
||||
[breakver]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md
|
||||
|
||||
## UNRELEASED
|
||||
|
||||
* updated deps:
|
||||
|
||||
```clj
|
||||
[metosin/malli "0.0.1-20200924.063109-27"] is available but we use "0.0.1-20200715.082439-21"
|
||||
[metosin/spec-tools "0.10.4"] is available but we use "0.10.3"
|
||||
[metosin/jsonista "0.2.7"] is available but we use "0.2.6"
|
||||
[com.fasterxml.jackson.core/jackson-core "2.11.2"] is available but we use "2.11.0"
|
||||
[com.fasterxml.jackson.core/jackson-databind "2.11.2"] is available but we use "2.11.0"
|
||||
```
|
||||
|
||||
### `reitit-malli`
|
||||
|
||||
* `:map-of` keys in JSON are correctly decoded using string-decoders
|
||||
* new `:encode-error` option in coercion:
|
||||
|
||||
```clj
|
||||
(def coercion
|
||||
(reitit.coercion.malli/create
|
||||
{:encode-error (fn [error] {:errors (:humanized error)})}))
|
||||
; results in... => {:status 400, :body {:errors {:x ["missing required key"]}}}
|
||||
```
|
||||
|
||||
## 0.5.5 (2020-07-15)
|
||||
|
||||
* recompile with Java8
|
||||
|
|
|
|||
|
|
@ -18,19 +18,6 @@
|
|||
[clojure.java.io :as io]
|
||||
[malli.util :as mu]))
|
||||
|
||||
(def sample-request
|
||||
[:map {:registry {::age [:and int? [:> 18]]}}
|
||||
[:age ::age]])
|
||||
|
||||
(malli.core/accept
|
||||
(malli.core/schema sample-request)
|
||||
(malli.core/schema-visitor identity))
|
||||
|
||||
(defn handle [request]
|
||||
(prn (:parameters request))
|
||||
{:status 200
|
||||
:body {:status "ok"}})
|
||||
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
|
|
@ -67,12 +54,6 @@
|
|||
["/math"
|
||||
{:swagger {:tags ["math"]}}
|
||||
|
||||
["/api/v1/overview"
|
||||
{:swagger {:tags ["Overview"]}
|
||||
:post {:summary "get an overview data"
|
||||
:parameters {:body sample-request}
|
||||
:handler handle}}]
|
||||
|
||||
["/plus"
|
||||
{:get {:summary "plus with malli query parameters"
|
||||
:parameters {:query [:map [:x int?] [:y int?]]}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@
|
|||
:strip-extra-keys true
|
||||
;; add/set default values
|
||||
:default-values true
|
||||
;; encode-error
|
||||
:encode-error nil
|
||||
;; malli options
|
||||
:options nil})
|
||||
|
||||
|
|
@ -130,7 +132,7 @@
|
|||
([]
|
||||
(create nil))
|
||||
([opts]
|
||||
(let [{:keys [transformers compile options error-keys] :as opts} (merge default-options opts)
|
||||
(let [{:keys [transformers compile options error-keys encode-error] :as opts} (merge default-options opts)
|
||||
show? (fn [key] (contains? error-keys key))
|
||||
transformers (walk/prewalk #(if (satisfies? TransformationProvider %) (-transformer % opts) %) transformers)]
|
||||
^{:type ::coercion/coercion}
|
||||
|
|
@ -171,7 +173,8 @@
|
|||
(show? :schema) (update :schema edn/write-string opts)
|
||||
(show? :errors) (-> (me/with-error-messages opts)
|
||||
(update :errors (partial map #(update % :schema edn/write-string opts))))
|
||||
(seq error-keys) (select-keys error-keys)))
|
||||
(seq error-keys) (select-keys error-keys)
|
||||
encode-error (encode-error)))
|
||||
(-request-coercer [_ type schema]
|
||||
(-coercer (compile schema options) type transformers :decode nil opts))
|
||||
(-response-coercer [_ schema]
|
||||
|
|
|
|||
26
project.clj
26
project.clj
|
|
@ -28,16 +28,16 @@
|
|||
[metosin/reitit-sieppari "0.5.5"]
|
||||
[metosin/reitit-pedestal "0.5.5"]
|
||||
[metosin/ring-swagger-ui "3.25.3"]
|
||||
[metosin/spec-tools "0.10.3"]
|
||||
[metosin/spec-tools "0.10.4"]
|
||||
[metosin/schema-tools "0.12.2"]
|
||||
[metosin/muuntaja "0.6.7"]
|
||||
[metosin/jsonista "0.2.6"]
|
||||
[metosin/jsonista "0.2.7"]
|
||||
[metosin/sieppari "0.0.0-alpha13"]
|
||||
[metosin/malli "0.0.1-20200715.082439-21"]
|
||||
[metosin/malli "0.0.1-20200924.063109-27"]
|
||||
|
||||
;; https://clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111
|
||||
[com.fasterxml.jackson.core/jackson-core "2.11.0"]
|
||||
[com.fasterxml.jackson.core/jackson-databind "2.11.0"]
|
||||
[com.fasterxml.jackson.core/jackson-core "2.11.2"]
|
||||
[com.fasterxml.jackson.core/jackson-databind "2.11.2"]
|
||||
|
||||
[meta-merge "1.0.0"]
|
||||
[fipp "0.6.23" :exclusions [org.clojure/core.rrb-vector]]
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
;[lein-virgil "0.1.7"]
|
||||
[lein-doo "0.1.11"]
|
||||
[lein-cljsbuild "1.1.8"]
|
||||
[lein-cloverage "1.1.2"]
|
||||
[lein-cloverage "1.2.1"]
|
||||
[lein-codox "0.10.7"]
|
||||
[metosin/bat-test "0.4.4"]]
|
||||
|
||||
|
|
@ -82,10 +82,10 @@
|
|||
|
||||
;; modules dependencies
|
||||
[metosin/schema-tools "0.12.2"]
|
||||
[metosin/spec-tools "0.10.3"]
|
||||
[metosin/spec-tools "0.10.4"]
|
||||
[metosin/muuntaja "0.6.7"]
|
||||
[metosin/sieppari]
|
||||
[metosin/jsonista "0.2.6"]
|
||||
[metosin/jsonista "0.2.7"]
|
||||
[metosin/malli]
|
||||
[lambdaisland/deep-diff "0.0-47"]
|
||||
[meta-merge "1.0.0"]
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
[expound "0.8.5"]
|
||||
[fipp "0.6.23"]
|
||||
|
||||
[orchestra "2019.02.06-1"]
|
||||
[orchestra "2020.09.18-1"]
|
||||
|
||||
[ring "1.8.1"]
|
||||
[ikitommi/immutant-web "3.0.0-alpha1"]
|
||||
|
|
@ -101,13 +101,13 @@
|
|||
[metosin/ring-swagger-ui "3.25.3"]
|
||||
|
||||
[criterium "0.4.6"]
|
||||
[org.clojure/test.check "1.0.0"]
|
||||
[org.clojure/test.check "1.1.0"]
|
||||
[org.clojure/tools.namespace "1.0.0"]
|
||||
[com.gfredericks/test.chuck "0.2.10"]
|
||||
|
||||
[io.pedestal/pedestal.service "0.5.8"]
|
||||
|
||||
[org.clojure/core.async "1.2.603"]
|
||||
[org.clojure/core.async "1.3.610"]
|
||||
[manifold "0.1.8"]
|
||||
[funcool/promesa "5.1.0"]
|
||||
|
||||
|
|
@ -120,13 +120,13 @@
|
|||
"-Xmx4096m"
|
||||
"-Dclojure.compiler.direct-linking=true"]
|
||||
:test-paths ["perf-test/clj"]
|
||||
:dependencies [[compojure "1.6.1"]
|
||||
:dependencies [[compojure "1.6.2"]
|
||||
[ring/ring-defaults "0.3.2"]
|
||||
[ikitommi/immutant-web "3.0.0-alpha1"]
|
||||
[io.pedestal/pedestal.service "0.5.8"]
|
||||
[io.pedestal/pedestal.jetty "0.5.8"]
|
||||
[calfpath "0.7.2"]
|
||||
[org.clojure/core.async "1.2.603"]
|
||||
[org.clojure/core.async "1.3.610"]
|
||||
[manifold "0.1.8"]
|
||||
[funcool/promesa "5.1.0"]
|
||||
[metosin/sieppari]
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@
|
|||
{:data {:middleware middleware
|
||||
:coercion malli/coercion}})))]
|
||||
|
||||
(testing "withut exception handling"
|
||||
(testing "without exception handling"
|
||||
(let [app (create [rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware])]
|
||||
|
||||
|
|
@ -394,6 +394,11 @@
|
|||
(is (= {:status 200, :body {:x 1, :request true, :response true}}
|
||||
(app (->request "open")))))))
|
||||
|
||||
(testing "encoding errors"
|
||||
(let [app (->app {:encode-error (fn [error] {:errors (:humanized error)})})]
|
||||
(is (= {:status 400, :body {:errors {:x ["missing required key"]}}}
|
||||
(app (assoc (->request "closed") :body-params {}))))))
|
||||
|
||||
(testing "when schemas are not closed and extra keys are not stripped"
|
||||
(let [app (->app {:compile (fn [v _] v) :strip-extra-keys false})]
|
||||
(testing "default: keys are NOT stripped"
|
||||
|
|
|
|||
Loading…
Reference in a new issue