Skip to content

Commit aee7f9a

Browse files
committed
Update deps
1 parent 66f0218 commit aee7f9a

File tree

4 files changed

+58
-53
lines changed

4 files changed

+58
-53
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## UNRELEASED
2+
3+
* Spec Coercion enchancements
4+
* See [spec-tools 0.9.0 changelog](https://github.com/metosin/spec-tools/blob/master/CHANGELOG.md)
5+
* Coercion flows values through both `st/coerce` and `st/conform`, by [Miguel Ping](https://github.com/mping)
6+
7+
* Updated dependencies:
8+
9+
```clj
10+
[prismatic/schema "1.1.10"] is available but we use "1.1.9"
11+
[metosin/muuntaja "0.6.3"] is available but we use "0.6.1"
12+
[com.fasterxml.jackson.datatype/jackson-datatype-joda "2.9.8"] is available but we use "2.9.7"
13+
[metosin/spec-tools "0.9.0-SNAPSHOT"] is available but we use "0.8.2"
14+
```
15+
116
## 2.0.0-alpha28 (2018-11-19)
217

318
* Expose full `clojure.spec` problems for exception handlers, to use pretty-printers like [expound](https://github.com/bhb/expound):

project.clj

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,41 @@
66
:distribution :repo
77
:comments "same as Clojure"}
88
:dependencies [[potemkin "0.4.5"]
9-
[prismatic/schema "1.1.9"]
9+
[prismatic/schema "1.1.10"]
1010
[prismatic/plumbing "0.5.5"]
1111
[ikitommi/linked "1.3.1-alpha1"] ;; waiting for the original
12-
[metosin/muuntaja "0.6.1"]
13-
[com.fasterxml.jackson.datatype/jackson-datatype-joda "2.9.7"]
12+
[metosin/muuntaja "0.6.3"]
13+
[com.fasterxml.jackson.datatype/jackson-datatype-joda "2.9.8"]
1414
[ring/ring-core "1.7.1" :exclusions [clj-time commons-codec]]
1515
[compojure "1.6.1" :exclusions [joda-time]]
16-
[metosin/spec-tools "0.8.2"]
16+
[metosin/spec-tools "0.9.0-SNAPSHOT"]
1717
[metosin/ring-http-response "0.9.1" :exclusions [joda-time]]
1818
[metosin/ring-swagger-ui "2.2.10"]
1919
[metosin/ring-swagger "0.26.1" :exclusions [joda-time]]]
2020
:profiles {:uberjar {:aot :all
2121
:ring {:handler examples.thingie/app}
2222
:source-paths ["examples/thingie/src"]
23-
:dependencies [[org.clojure/clojure "1.9.0"]
23+
:dependencies [[org.clojure/clojure "1.10.0"]
2424
[http-kit "2.3.0"]
2525
[reloaded.repl "0.2.4"]
26-
[com.stuartsierra/component "0.3.2"]]}
26+
[com.stuartsierra/component "0.4.0"]]}
2727
:dev {:plugins [[lein-clojars "0.9.1"]
2828
[lein-midje "3.2.1"]
29-
[lein-ring "0.12.4"]
29+
[lein-ring "0.12.5"]
3030
[funcool/codeina "0.5.0"]]
31-
:dependencies [[org.clojure/clojure "1.9.0"]
32-
[org.clojure/core.async "0.4.474" :exclusions [org.clojure/tools.reader]]
31+
:dependencies [[org.clojure/clojure "1.10.0"]
32+
[org.clojure/core.async "0.4.490" :exclusions [org.clojure/tools.reader]]
3333
[javax.servlet/javax.servlet-api "4.0.1"]
3434
[peridot "0.5.1" :exclusions [clj-time commons-codec]]
35-
[midje "1.9.4" :exclusions [org.clojure/tools.namespace com.rpl/specter commons-codec clj-time]]
35+
[midje "1.9.6" :exclusions [org.clojure/tools.namespace com.rpl/specter commons-codec clj-time]]
3636
[com.rpl/specter "1.1.2"]
37-
[com.stuartsierra/component "0.3.2"]
38-
[expound "0.7.1"]
37+
[com.stuartsierra/component "0.4.0"]
38+
[expound "0.7.2"]
3939
[metosin/jsonista "0.2.2"]
4040
[reloaded.repl "0.2.4"]
41-
[metosin/muuntaja-msgpack "0.6.1"]
42-
;; FIXME: https://github.com/amalloy/ordered/pull/37
43-
[metosin/muuntaja-yaml "0.6.1" :exclusions [org.flatland/ordered]]
44-
[org.flatland/ordered "1.5.7"]
45-
[org.immutant/web "2.1.10" :exclusions [joda-time org.slf4j/slf4j-api]]
41+
[metosin/muuntaja-msgpack "0.6.3"]
42+
[metosin/muuntaja-yaml "0.6.3"]
43+
[org.immutant/immutant "2.1.10" :exclusions [joda-time org.slf4j/slf4j-api]]
4644
[http-kit "2.3.0"]
4745
[criterium "0.4.4"]]
4846
:test-paths ["test19"]
@@ -54,9 +52,9 @@
5452
"-Xmx4096m"
5553
"-Dclojure.compiler.direct-linking=true"]}
5654
:logging {:dependencies [[org.clojure/tools.logging "0.4.1"]
57-
[org.slf4j/jcl-over-slf4j "1.7.25"]
58-
[org.slf4j/jul-to-slf4j "1.7.25"]
59-
[org.slf4j/log4j-over-slf4j "1.7.25"]
55+
[org.slf4j/jcl-over-slf4j "1.7.26"]
56+
[org.slf4j/jul-to-slf4j "1.7.26"]
57+
[org.slf4j/log4j-over-slf4j "1.7.26"]
6058
[ch.qos.logback/logback-classic "1.2.3" :exclusions [org.slf4j/slf4j-api]]]}
6159
:async {:jvm-opts ["-Dcompojure-api.test.async=true"]
6260
:dependencies [[manifold "0.1.8" :exclusions [org.clojure/tools.logging]]]}}

test/compojure/api/integration_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@
11011101
:path-params [id ::id]
11021102
:name :pong
11031103
identity))]
1104-
(eval app') => (throws #"did you mean"))))
1104+
(eval app') => (throws RuntimeException))))
11051105

11061106
(fact "swagger-spec-path"
11071107
(fact "defaults to /swagger.json"

test19/compojure/api/coercion/spec_coercion_explain_test.clj

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
[compojure.api.test-utils :refer :all]
66
[compojure.api.sweet :refer :all]
77
[compojure.api.request :as request]
8-
[compojure.api.coercion :as coercion]
9-
[spec-tools.core :as st]))
8+
[compojure.api.coercion :as coercion]))
109

1110
(s/def ::birthdate spec/inst?)
1211

@@ -22,40 +21,33 @@
2221
:req-un [::name ::languages ::age]
2322
:opt-un [::birthdate]))
2423

25-
(def custom-coercion
26-
(-> compojure.api.coercion.spec/default-options
27-
(assoc-in
28-
[:body :formats "application/json"]
29-
st/string-transformer)
30-
compojure.api.coercion.spec/create-coercion))
31-
3224
(def valid-value {:name "foo" :age "24" :languages ["clj"] :birthdate "1968-01-02T15:04:05Z"})
3325
(def coerced-value {:name "foo" :age "24" :languages #{:clj} :birthdate #inst "1968-01-02T15:04:05Z"})
3426
(def invalid-value {:name "foo" :age "24" :lanxguages ["clj"] :birthdate "1968-01-02T15:04:05Z"})
3527

3628
(fact "request-coercion"
37-
(let [c! #(coercion/coerce-request! ::spec :body-params :body false false %)]
38-
39-
(fact "default coercion"
40-
(c! {:body-params valid-value
41-
:muuntaja/request {:format "application/json"}
42-
::request/coercion :spec}) => coerced-value
43-
(c! {:body-params invalid-value
44-
:muuntaja/request {:format "application/json"}
45-
::request/coercion :spec}) => (throws)
46-
(try
47-
(c! {:body-params invalid-value
48-
:muuntaja/request {:format "application/json"}
49-
::request/coercion :spec})
50-
(catch Exception e
51-
(let [data (ex-data e)
52-
spec-problems (get-in data [:problems ::s/problems])]
53-
(count spec-problems) => 1
54-
(first spec-problems) => (contains {:in []
55-
:path []
56-
:val {:age "24"
57-
:birthdate #inst "1968-01-02T15:04:05Z"
58-
:name "foo"}
59-
:via [::spec]})))))))
29+
(let [c! #(coercion/coerce-request! ::spec :body-params :body false false %)]
30+
31+
(fact "default coercion"
32+
(c! {:body-params valid-value
33+
:muuntaja/request {:format "application/json"}
34+
::request/coercion :spec}) => coerced-value
35+
(c! {:body-params invalid-value
36+
:muuntaja/request {:format "application/json"}
37+
::request/coercion :spec}) => (throws)
38+
(try
39+
(c! {:body-params invalid-value
40+
:muuntaja/request {:format "application/json"}
41+
::request/coercion :spec})
42+
(catch Exception e
43+
(let [data (ex-data e)
44+
spec-problems (get-in data [:problems ::s/problems])]
45+
(count spec-problems) => 1
46+
(first spec-problems) => (contains {:in []
47+
:path []
48+
:val {:age "24"
49+
:birthdate #inst "1968-01-02T15:04:05Z"
50+
:name "foo"}
51+
:via [::spec]})))))))
6052

6153

0 commit comments

Comments
 (0)