From e779ea1965a1790f8807d017af771c6fe6ed3190 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sun, 31 Dec 2017 12:06:21 +0200 Subject: [PATCH] . --- doc/ring/compiling_middleware.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/ring/compiling_middleware.md b/doc/ring/compiling_middleware.md index 1c200a57..9443f9d5 100644 --- a/doc/ring/compiling_middleware.md +++ b/doc/ring/compiling_middleware.md @@ -47,15 +47,17 @@ To demonstrate the two approaches, below are response coercion middleware writte * Route information is provided via a closure * Pre-compiled coercers * Mounts only if `:coercion` and `:responses` are defined for the route +* Also defines spec for the route data `:responses` for the [route data validation](route_data_validation.md). ```clj -(require '[reitit.middleware :as middleware]) +(require '[reitit.spec :as rs]) (def coerce-response-middleware "Middleware for pluggable response coercion. Expects a :coercion of type `reitit.coercion/Coercion` and :responses from route data, otherwise does not mount." {:name ::coerce-response + :spec ::rs/responses :compile (fn [{:keys [coercion responses]} opts] (if (and coercion responses) (let [coercers (coercion/response-coercers coercion responses opts)]