Skip to content

Commit

Permalink
Merge pull request #687 from metosin/fix-686
Browse files Browse the repository at this point in the history
Fix for #686
  • Loading branch information
ikitommi authored Jun 29, 2024
2 parents 411bf39 + e0cc8b4 commit 72dadb3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 20 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino

[breakver]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md

## UNRELEASED

* FIX: Clojure record in route data is converted to a plain map [#686](https://github.com/metosin/reitit/issues/686)
* Updated dependencies:

```clojure
[com.fasterxml.jackson.core/jackson-core "2.17.1"] is available but we use "2.17.0"
[com.fasterxml.jackson.core/jackson-databind "2.17.1"] is available but we use "2.17.0"
[ring/ring-core "1.12.2"] is available but we use "1.12.1"
[ring "1.12.2"] is available but we use "1.12.1"
```

## 0.7.0 (2024-04-30)

The OpenAPI3 release, Year in the making - the changes span over multiple repositories.
Expand Down
2 changes: 1 addition & 1 deletion modules/reitit-core/src/reitit/impl.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
f (-match p' path-map)]
(cond
f (conj l [p' (f v)])
(and (map? v) (seq v)) (-path-vals l p' v)
(and (map? v) (not (record? v)) (seq v)) (-path-vals l p' v)
:else (conj l [p' v]))))
l m))]
(-path-vals [] [] m)))
Expand Down
24 changes: 12 additions & 12 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
[metosin/malli "0.16.1"]

;; https://clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111
[com.fasterxml.jackson.core/jackson-core "2.17.0"]
[com.fasterxml.jackson.core/jackson-databind "2.17.0"]
[com.fasterxml.jackson.core/jackson-core "2.17.1"]
[com.fasterxml.jackson.core/jackson-databind "2.17.1"]

[meta-merge "1.0.0"]
[fipp "0.6.26" :exclusions [org.clojure/core.rrb-vector]]
Expand All @@ -53,9 +53,9 @@
[lambdaisland/deep-diff "0.0-47"]
[com.bhauman/spell-spec "0.1.2"]
[mvxcvi/arrangement "2.1.0"]
[ring/ring-core "1.12.1"]
[ring/ring-core "1.12.2"]

[io.pedestal/pedestal.service "0.6.3"]]
[io.pedestal/pedestal.service "0.6.4"]]

:plugins [[jonase/eastwood "1.4.2"]
;[lein-virgil "0.1.7"]
Expand Down Expand Up @@ -106,7 +106,7 @@

[orchestra "2021.01.01-1"]

[ring "1.12.1"]
[ring "1.12.2"]
[ikitommi/immutant-web "3.0.0-alpha1"]
[metosin/ring-http-response "0.9.3"]
[metosin/ring-swagger-ui "5.9.0"]
Expand All @@ -118,13 +118,13 @@
[com.gfredericks/test.chuck "0.2.14"]
[nubank/matcher-combinators "3.9.1"]

[io.pedestal/pedestal.service "0.6.3"]
[io.pedestal/pedestal.service "0.6.4"]

[org.clojure/core.async "1.6.681"]
[manifold "0.4.2"]
[manifold "0.4.3"]
[funcool/promesa "11.0.678"]

[com.clojure-goes-fast/clj-async-profiler "1.2.0"]
[com.clojure-goes-fast/clj-async-profiler "1.2.2"]
[ring-cors "0.1.13"]

[com.bhauman/rebel-readline "0.1.4"]]}
Expand All @@ -135,15 +135,15 @@
:dependencies [[compojure "1.7.1"]
[ring/ring-defaults "0.5.0"]
[ikitommi/immutant-web "3.0.0-alpha1"]
[io.pedestal/pedestal.service "0.6.3"]
[io.pedestal/pedestal.jetty "0.6.3"]
[io.pedestal/pedestal.service "0.6.4"]
[io.pedestal/pedestal.jetty "0.6.4"]
[calfpath "0.8.1"]
[org.clojure/core.async "1.6.681"]
[manifold "0.4.2"]
[manifold "0.4.3"]
[funcool/promesa "11.0.678"]
[metosin/sieppari]
[yada "1.2.16"]
[aleph "0.7.1"]
[aleph "0.8.1"]
[ring/ring-defaults "0.5.0"]
[ataraxy "0.4.3"]
[bidi "2.1.6"]
Expand Down
8 changes: 4 additions & 4 deletions test/cljc/reitit/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@
(is result)
(is (= "ok" (result))))
(testing "var handler gets expanded"
(let [router (r/router ["/ping" #'var-handler])
{:keys [result]} (r/match-by-path router "/ping")]
(is (= #'var-handler result))))))
(let [router (r/router ["/ping" #'var-handler])
{:keys [result]} (r/match-by-path router "/ping")]
(is (= #'var-handler result))))))

(testing "custom router"
(let [router (r/router ["/ping"] {:router (fn [_ _]
Expand Down Expand Up @@ -423,7 +423,7 @@
(r/expand [_ _] {:name n}))

(deftest default-expand-test
(let [router (r/router ["/endpoint" (->Named :kikka)])]
(let [router (r/router ["/endpoint" (Named. :kikka)])]
(is (= [["/endpoint" {:name :kikka}]]
(r/routes router)))))

Expand Down
19 changes: 16 additions & 3 deletions test/cljc/reitit/ring_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@
{::trie/trie-compiler compiler})]
(dotimes [_ 10]
(future
(dotimes [n 100000]
(let [body (:body (app {:request-method :get, :uri (str "/" n)}))]
(is (= body (str n))))))))))))
(dotimes [n 100000]
(let [body (:body (app {:request-method :get, :uri (str "/" n)}))]
(is (= body (str n))))))))))))

(declare routes)

Expand All @@ -760,3 +760,16 @@
(is (= (r "2") (app {:uri "/", :request-method :get})))
(def routes ["/" (constantly (r "3"))]) ;; redefine again
(is (= (r "3") (app {:uri "/", :request-method :get}))))))))

(defrecord FooTest [a b])

(deftest path-update-fix-686
(testing "records are retained"
(is (record? (-> ["/api/foo" {:get {:handler (constantly {:status 200})
:test (FooTest. 1 2)}}]
(ring/router)
(r/compiled-routes)
(first)
(second)
:get
:test)))))

0 comments on commit 72dadb3

Please sign in to comment.