File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 33## NEXT
44* drop support for Clojure 1.8
55* upgrade cheshire 5.13.0
6+ * Backport: use muuntaja in compojure.api.validator
67
78## 1.1.14 (2024-04-30)
89* 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 11(ns compojure.api.validator
22 (:require [compojure.api.swagger :as swagger]
3- [cheshire.core :as cheshire ]
3+ [compojure.api.impl.json :as json ]
44 [ring.swagger.validator :as rsv]
5+ [muuntaja.core :as m]
56 [compojure.api.middleware :as mw]))
67
78(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
910 is requested and validated against the JSON Schema. Returns either
1011 the (valid) api or throws an exception. Requires lazily the
1112 ring.swagger.validator -namespace allowing it to be excluded, #227"
1213 [api]
1314 (when-let [uri (swagger/swagger-spec-path api)]
1415 (let [{status :status :as response} (api {:request-method :get
1516 :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 " ))]
1819
1920 (when-not (= status 200 )
2021 (throw (ex-info (str " Coudn't read swagger spec from " uri)
You can’t perform that action at this time.
0 commit comments