mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 00:41:12 +00:00
Use latest malli fixing visitors
This commit is contained in:
parent
f624dc34d9
commit
b651fac0b0
4 changed files with 19 additions and 9 deletions
|
|
@ -15,7 +15,8 @@
|
||||||
; [spec-tools.spell :as spell]
|
; [spec-tools.spell :as spell]
|
||||||
[ring.adapter.jetty :as jetty]
|
[ring.adapter.jetty :as jetty]
|
||||||
[muuntaja.core :as m]
|
[muuntaja.core :as m]
|
||||||
[clojure.java.io :as io]))
|
[clojure.java.io :as io]
|
||||||
|
[malli.util :as mu]))
|
||||||
|
|
||||||
(def app
|
(def app
|
||||||
(ring/ring-handler
|
(ring/ring-handler
|
||||||
|
|
@ -70,7 +71,16 @@
|
||||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation
|
;;:reitit.spec/wrap spell/closed ;; strict top-level validation
|
||||||
:exception pretty/exception
|
:exception pretty/exception
|
||||||
:data {:coercion (reitit.coercion.malli/create
|
:data {:coercion (reitit.coercion.malli/create
|
||||||
{:error-keys #{#_:type :coercion :in :humanized :schema :value #_:transformed #_:errors}})
|
{;; set of keys to include in error messages
|
||||||
|
:error-keys #{#_:type :coercion :in :schema :value :errors :humanized #_:transformed}
|
||||||
|
;; schema identity function (default: close all map schemas)
|
||||||
|
:compile mu/closed-schema
|
||||||
|
;; strip-extra-keys (effects only predefined transformers)
|
||||||
|
:strip-extra-keys true
|
||||||
|
;; add/set default values
|
||||||
|
:default-values true
|
||||||
|
;; malli options
|
||||||
|
:options nil})
|
||||||
:muuntaja m/instance
|
:muuntaja m/instance
|
||||||
:middleware [;; swagger feature
|
:middleware [;; swagger feature
|
||||||
swagger/swagger-feature
|
swagger/swagger-feature
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(defmethod print-method ::coercion [coercion ^Writer w]
|
(defmethod print-method ::coercion [coercion ^Writer w]
|
||||||
(.write w (str "<<" (-get-name coercion) ">>"))))
|
(.write w (str "#Coercion{:name " (-get-name coercion) "}"))))
|
||||||
|
|
||||||
(defrecord CoercionError [])
|
(defrecord CoercionError [])
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@
|
||||||
;; api-docs
|
;; api-docs
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defn get-apidocs [this specification data]
|
(defn get-apidocs [coercion specification data]
|
||||||
(let [swagger-parameter {:query :query
|
(let [swagger-parameter {:query :query
|
||||||
:body :body
|
:body :body
|
||||||
:form :formData
|
:form :formData
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
(map (fn [[k v]] [(swagger-parameter k) v]))
|
(map (fn [[k v]] [(swagger-parameter k) v]))
|
||||||
(filter first)
|
(filter first)
|
||||||
(into {}))))
|
(into {}))))
|
||||||
(-get-apidocs this specification)))))
|
(-get-apidocs coercion specification)))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; integration
|
;; integration
|
||||||
|
|
|
||||||
|
|
@ -109,11 +109,11 @@
|
||||||
:response {:default default-transformer-provider}}
|
:response {:default default-transformer-provider}}
|
||||||
;; set of keys to include in error messages
|
;; set of keys to include in error messages
|
||||||
:error-keys #{:type :coercion :in :schema :value :errors :humanized #_:transformed}
|
:error-keys #{:type :coercion :in :schema :value :errors :humanized #_:transformed}
|
||||||
;; schema identity function
|
;; schema identity function (default: close all map schemas)
|
||||||
:compile mu/closed-schema
|
:compile mu/closed-schema
|
||||||
;; strip-extra-keys (effects only default transformers!)
|
;; strip-extra-keys (effects only predefined transformers)
|
||||||
:strip-extra-keys true
|
:strip-extra-keys true
|
||||||
;; add default values
|
;; add/set default values
|
||||||
:default-values true
|
:default-values true
|
||||||
;; malli options
|
;; malli options
|
||||||
:options nil})
|
:options nil})
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
[metosin/muuntaja "0.6.5"]
|
[metosin/muuntaja "0.6.5"]
|
||||||
[metosin/jsonista "0.2.5"]
|
[metosin/jsonista "0.2.5"]
|
||||||
[metosin/sieppari "0.0.0-alpha7"]
|
[metosin/sieppari "0.0.0-alpha7"]
|
||||||
[metosin/malli "0.0.1-20200106.232607-10"]
|
[metosin/malli "0.0.1-20200108.194558-11"]
|
||||||
|
|
||||||
[meta-merge "1.0.0"]
|
[meta-merge "1.0.0"]
|
||||||
[fipp "0.6.21" :exclusions [org.clojure/core.rrb-vector]]
|
[fipp "0.6.21" :exclusions [org.clojure/core.rrb-vector]]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue