                       context
                       (assoc :context (string/join "/" (cons "" context))))
             handlers' (assoc handlers handler-key handler)]
-        [routes' handlers' middleware']))))
+        [routes' handlers' middleware' namespaces-metadata']))))
 
 (defn- analyse-dispatch-table
   "Returns a map holding a map of route-spec* -> handler-sym at

  [routes]
  (into (sorted-map-by compare-route-specs) routes))

(defn- analyze*
  [routes handlers middleware extra-arg-resolvers dispatch-table-entry]
  (if-let [[method pathvec verb-fn-sym mw-spec] dispatch-table-entry]
    (t/track
      (format "Analyzing resource handler function `%s'." verb-fn-sym)
      (let [handler-key (gensym "handler-key__")
            routes' (assoc routes
                      [method (keywords->symbols pathvec)] handler-key)
            [middleware' middleware-key] (if (contains? middleware mw-spec)
                                   [middleware (get middleware mw-spec)]
                                   (let [mw-sym (gensym "middleware-key__")]
                                     [(assoc middleware mw-spec mw-sym) mw-sym]))
            ns (-> verb-fn-sym namespace symbol the-ns)
            ;; Seems like we should just do the *ns* binding trick once
            ;; per namespace. Possibly as an additional map passed into
            ;; analyze*
            ns-metadata (binding [*ns* ns]
                          (-> ns meta eval (dissoc :doc)))
            metadata (merge ns-metadata (meta (resolve verb-fn-sym)))
            route-params (mapv (comp symbol name)
                               (filter keyword? pathvec))

    metadata."
  [dispatch-table options]
  (let [extra-arg-resolvers (:arg-resolvers options)]
    (loop [analyze-state nil
           entries    (seq (unnest-dispatch-table dispatch-table))]
      (if-let [analyze-state' (analyze* analyze-state extra-arg-resolvers (first entries))]
        (recur analyze-state' (next entries))
        (let [[routes handlers middleware] analyze-state]
          {:routes     (sorted-routes routes)
           :handlers   handlers
           :middleware (set/map-invert middleware)})))))

(defn- map-traversal-dispatcher
  "Returns a Ring handler using the given dispatch-map to guide
