File tree 3 files changed +9
-4
lines changed
3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 3
3
## NEXT
4
4
* drop support for Clojure 1.8
5
5
* upgrade cheshire 5.13.0
6
+ * Backport: use muuntaja in compojure.api.validator
6
7
7
8
## 1.1.14 (2024-04-30)
8
9
* Remove potemkin [ #445 ] ( https://github.com/metosin/compojure-api/issues/445 )
Original file line number Diff line number Diff line change
1
+ (ns compojure.api.methods )
2
+
3
+ (def all-methods #{:get :head :patch :delete :options :post :put })
Original file line number Diff line number Diff line change 1
1
(ns compojure.api.validator
2
2
(:require [compojure.api.swagger :as swagger]
3
- [cheshire.core :as cheshire ]
3
+ [compojure.api.impl.json :as json ]
4
4
[ring.swagger.validator :as rsv]
5
+ [muuntaja.core :as m]
5
6
[compojure.api.middleware :as mw]))
6
7
7
8
(defn validate
8
- " Validates a api. If the api is Swagger-enabled, the swagger-spec
9
+ " Validates an api. If the api is Swagger-enabled, the swagger-spec
9
10
is requested and validated against the JSON Schema. Returns either
10
11
the (valid) api or throws an exception. Requires lazily the
11
12
ring.swagger.validator -namespace allowing it to be excluded, #227"
12
13
[api]
13
14
(when-let [uri (swagger/swagger-spec-path api)]
14
15
(let [{status :status :as response} (api {:request-method :get
15
16
:uri uri
16
- mw/rethrow-exceptions? true })
17
- body (-> response :body slurp ( cheshire/parse-string true ))]
17
+ :: mw/rethrow-exceptions? true })
18
+ body (->> response :body ( m/decode json/muuntaja " application/json " ))]
18
19
19
20
(when-not (= status 200 )
20
21
(throw (ex-info (str " Coudn't read swagger spec from " uri)
You can’t perform that action at this time.
0 commit comments