mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
rename extract-request-format
This commit is contained in:
parent
0f03d0786c
commit
7514d1b263
2 changed files with 10 additions and 4 deletions
|
|
@ -1,5 +1,10 @@
|
|||
## UNRELEASED
|
||||
|
||||
## `reitit-core`
|
||||
|
||||
* **BREAKING**: the router option key to extract body format has been renamed: `:extract-request-format` => `:reitit.coercion/extract-request-format`
|
||||
* should only concern you if you are not using [Muuntaja](https://github.com/metosin/muuntaja).
|
||||
|
||||
## `reitit-swagger-ui`
|
||||
|
||||
* **BREAKING**: pass swagger-ui `:config` as-is (instead of mixed-casing keys) to swagger-ui, fixes [#109](https://github.com/metosin/reitit/issues/109):
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
(defrecord ParameterCoercion [in style keywordize? open?])
|
||||
|
||||
(def ^:no-doc defaut-parameter-coercion
|
||||
(def ^:no-doc default-parameter-coercion
|
||||
{:query (->ParameterCoercion :query-params :string true true)
|
||||
:body (->ParameterCoercion :body-params :body false false)
|
||||
:form (->ParameterCoercion :form-params :string true true)
|
||||
|
|
@ -70,10 +70,11 @@
|
|||
(-> request :muuntaja/request :format))
|
||||
|
||||
;; TODO: support faster key walking, walk/keywordize-keys is quite slow...
|
||||
(defn request-coercer [coercion type model {:keys [extract-request-format]
|
||||
:or {extract-request-format extract-request-format-default}}]
|
||||
(defn request-coercer [coercion type model {:keys [::extract-request-format ::parameter-coercion]
|
||||
:or {extract-request-format extract-request-format-default
|
||||
parameter-coercion default-parameter-coercion}}]
|
||||
(if coercion
|
||||
(let [{:keys [keywordize? open? in style]} (defaut-parameter-coercion type)
|
||||
(let [{:keys [keywordize? open? in style]} (parameter-coercion type)
|
||||
transform (comp (if keywordize? walk/keywordize-keys identity) in)
|
||||
model (if open? (-open-model coercion model) model)
|
||||
coercer (-request-coercer coercion style model)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue