        :handlers   handlers
        :middleware (set/map-invert middleware)})))
 
+(defn wrap-with-schema [handler schema]
+  (fn [request]
+    (handler (assoc-in request [:rook :metadata :schema] schema))))
+
 (defn handler-form
   "Returns a Clojure form evaluating to a handler wrapped in middleware.
   The middleware stack includes the specified arg-resolvers, if any,

           verb-fn-sym
           arglist
           arg-resolvers
           sync?]}]
  (let [prewrap-handler-sym (gensym (str handler-sym "__prewrap_handler__"))
        resolving-mw-sym    (gensym
                              (str middleware-sym "__with_arg_resolvers__"))]
    `(~apply-middleware
       ~(if (seq arg-resolvers)
          `(fn ~resolving-mw-sym [handler#]
             (-> handler#
               (rook/wrap-with-arg-resolvers ~@arg-resolvers)
               ~middleware-sym))
          middleware-sym)
       ~sync?
       (fn ~prewrap-handler-sym [~req]

                                    (map keyword route-params)
                                    route-params)]
                             (~handler-sym
                               (assoc ~req :route-params route-params#)))]))
               routes)
           :else nil)))))

