   [namespace]
   (remove nil?
           (map #(get-function-meta namespace %) (ns-paths namespace))))
-
-;(defn describe-context [context-path [path args namespace & contexts]]
-;  (let [new-context-path (str context-path path)
-;        handlers (scan-namespace-for-doc namespace)]
-;    (cons
-;      (desc/resource new-context-path namespace (ns-validation namespace) handlers)
-;      (map (partial describe-context new-context-path) contexts))))
-;
-;(defn doc-route-uncached [service contexts]
-;  (compojure/make-route :get "/"
-;                             (fn [request]
-;                               (let [html (desc/resource-page service
-;                                                              (map (partial describe-context "") contexts))]
-;                                 {:body html}))))
-;
-;(def doc-route (memo/memo doc-route-uncached))
-;
-;;if we want to namespace-specific for the cache, we will require a newer version of clojure.core.memoize
-;(defn clear-namespace-cache!
-;  "Clear namespace cache, forcing a re-scan of every namespace checked."
-;  []
-;  (memo/memo-clear! scan-namespace)
-;  (memo/memo-clear! doc-route))
-
-;(defn make-namespace-handler
-;  "Create a namespace handler, which will scan a namespace (cached) for functions matching the naming convention.
-;   <auths> should be a map of auth types to functions of request and permissions returning a ring response map."
-;  [namespace auths env service services]
-;  (fn [request]
-;    (apply compojure/routing request (scan-namespace namespace auths env service services))))
-;
-;(defn make-doc-handler
-;  "Create a namespace documention handler, which will scan namespaces (cached) for functions matching the naming convention."
-;  [service & contexts]
-;  (fn [request]
-;    (compojure/routing request (doc-route service contexts))))
-;
-;(defn resources [env service services auths contexts]
-;  (when (seq contexts)
-;    (doall (map (fn [[path args namespace & contexts]]
-;                  `(compojure/context ~path ~args
-;                                 (make-namespace-handler ~namespace ~auths ~env ~service ~services)
-;                                 ~@(resources env service services auths contexts)))
-;                contexts))))
-;
-;(defmacro routes
-;  "Creates compojure routes for the given <contexts>
-;   Each context should be of the form [<path> <args> <namespace> <context>*] where:
-;    * path is the context path (string) as supplied to compojure.core/context
-;    * args is a set of bindings as supplied to compojure.core/context
-;    * namespace is the namespace to scan for handlers
-;    * context is zero or more nested contexts
-;   <env> :environment setting from main conf
-;   <service> keyword identifying specific map in services
-;   <services> map of services, used to determine how to connect to other services
-;   <auths> should be a map of auth types to functions of request and permissions returning a ring response map
-;
-;   If :auth is specified in handler metadata it is used to lookup the auth function in <auths>, otherwise :default is used."
-;  [env service services auths & contexts]
-;  `(compojure/routes
-;     (make-doc-handler ~service ~@contexts)
-;     ~@(resources env service services auths contexts)))
 
 (defn build-map-arg-resolver [& kvs]
   (let [arg-map (apply hash-map kvs)]

                 (filter symbol-for-function? (map second (ns-publics namespace)))))
    DEFAULT-MAPPINGS))

;(defn- scan-namespace
;  "Build a seq of routes for namespace by adding custom routes (for fns with :path-spec metadata) to DEFAULT_MAPPINGS"
;  [namespace]
;  (let [paths (ns-paths namespace)]
;    (l/infof "Setting route mappings for %s to %s" namespace (l/pprint-str paths))
;    (remove nil?
;            (map #(make-function-route namespace auths env service services %) (ns-paths namespace)))))

;cache seems unnecessary as we build the list once per handler
;(def scan-namespace (memo/memo scan-namespace-uncached))

(defn get-function-meta
  "Get meta for route-mapping and namespace."
  [namespace [path-spec function-key]]

    (when (symbol-for-function? f) ;it has to be a function all right
      f)))


(defn- success?
  [{:keys [status]}]
  (<= 200 status 399))

(defn function-entry
  "Create function entry if it has :path-spec defined in its metadata, for example:
