Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5778f9b

Browse files
committed
Close#472: don't allow composite schemas to be cached
1 parentde6005f commit5778f9b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ See also: [compojure-api 1.1.x changelog](./CHANGELOG-1.1.x.md)
66
* Migration instructions: run your program and fix the error messages, which will provide specific instructions.
77
* to circumvent this change, set`-Dcompojure.api.middleware.global-default-formatter=:muuntaja`
88
* stable 2.x will default`:formatter` to`:ring-middleware-format`
9+
*[#472](https://github.com/metosin/compojure-api/issues/472): Fix potential memory leak involving schemas being cached in the multimethod default cache
910

1011
##2.0.0-alpha33 (2024-04-30)
1112
* Throw an error on malformed`:{body,query,headers}`, in particular if anything other than 2 elements was provided

‎src/compojure/api/coercion/schema.clj‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
(common/fifo-memoize sc/coercer1000))
3333

3434
;; don't use coercion for certain types
35-
(defmulticoerce-response?identity:default::default)
35+
(defmulticoerce-response? #(if (or (class? %)
36+
(keyword? %))
37+
%
38+
::default)
39+
:default::default)
3640
(defmethodcoerce-response?::default [_]true)
3741
(defmethodcoerce-response?File [_]false)
3842

‎test/compojure/api/coercion/schema_coercion_test.clj‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,10 @@
285285

286286
(testing"generates valid swagger spec"
287287
(is (validator/validate app)))))
288+
289+
(defsome-spec (s/conditional
290+
identity s/Int))
291+
(defmethodcs/coerce-response?some-spec [_]false)
292+
293+
(deftestcoerce-response-memory-leak-test
294+
(is (true? (cs/coerce-response? some-spec))))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp