diff --git a/examples/ring-malli-swagger/src/example/server.clj b/examples/ring-malli-swagger/src/example/server.clj index b4f63582..27260bd1 100644 --- a/examples/ring-malli-swagger/src/example/server.clj +++ b/examples/ring-malli-swagger/src/example/server.clj @@ -15,7 +15,8 @@ ; [spec-tools.spell :as spell] [ring.adapter.jetty :as jetty] [muuntaja.core :as m] - [clojure.java.io :as io])) + [clojure.java.io :as io] + [malli.util :as mu])) (def app (ring/ring-handler @@ -70,7 +71,16 @@ ;;:reitit.spec/wrap spell/closed ;; strict top-level validation :exception pretty/exception :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 :middleware [;; swagger feature swagger/swagger-feature diff --git a/modules/reitit-core/src/reitit/coercion.cljc b/modules/reitit-core/src/reitit/coercion.cljc index 07777db7..bcb7dfc9 100644 --- a/modules/reitit-core/src/reitit/coercion.cljc +++ b/modules/reitit-core/src/reitit/coercion.cljc @@ -21,7 +21,7 @@ #?(:clj (defmethod print-method ::coercion [coercion ^Writer w] - (.write w (str "<<" (-get-name coercion) ">>")))) + (.write w (str "#Coercion{:name " (-get-name coercion) "}")))) (defrecord CoercionError []) @@ -137,7 +137,7 @@ ;; api-docs ;; -(defn get-apidocs [this specification data] +(defn get-apidocs [coercion specification data] (let [swagger-parameter {:query :query :body :body :form :formData @@ -153,7 +153,7 @@ (map (fn [[k v]] [(swagger-parameter k) v])) (filter first) (into {})))) - (-get-apidocs this specification))))) + (-get-apidocs coercion specification))))) ;; ;; integration diff --git a/modules/reitit-malli/src/reitit/coercion/malli.cljc b/modules/reitit-malli/src/reitit/coercion/malli.cljc index fc1e9aef..411843da 100644 --- a/modules/reitit-malli/src/reitit/coercion/malli.cljc +++ b/modules/reitit-malli/src/reitit/coercion/malli.cljc @@ -109,11 +109,11 @@ :response {:default default-transformer-provider}} ;; set of keys to include in error messages :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 - ;; strip-extra-keys (effects only default transformers!) + ;; strip-extra-keys (effects only predefined transformers) :strip-extra-keys true - ;; add default values + ;; add/set default values :default-values true ;; malli options :options nil}) diff --git a/project.clj b/project.clj index 20194435..b84243c9 100644 --- a/project.clj +++ b/project.clj @@ -33,7 +33,7 @@ [metosin/muuntaja "0.6.5"] [metosin/jsonista "0.2.5"] [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"] [fipp "0.6.21" :exclusions [org.clojure/core.rrb-vector]]