 
   Returns the modified swagger-object."
   [swagger-options swagger-object routing-entry]
-  (let [path-str (-> routing-entry :path path->str)
-        ;; Ignoring :all for the moment.
-        method-str (-> routing-entry :method name)
-        pio-constructor (:path-item-object-injector swagger-options)]
-    ;; Invoke the constructor for the path info. It may need to make changes to the :definitions, so we have
-    ;; to let it modify the entire Swagger object ... but we help it out by providing the path
-    ;; to where the PathInfoObject (which describes what Rook calls a "route").
-    (pio-constructor swagger-options swagger-object routing-entry
-                     [:paths path-str method-str])))
+  (t/track
+    (format "Describing endpoint %s `/%s'."
+            (-> routing-entry :method name .toUpperCase)
+            (->> routing-entry :path (str/join "/")))
+    (let [path-str (-> routing-entry :path path->str)
+          ;; Ignoring :all for the moment.
+          method-str (-> routing-entry :method name)
+          pio-constructor (:path-item-object-injector swagger-options)]
+      ;; Invoke the constructor for the path info. It may need to make changes to the :definitions, so we have
+      ;; to let it modify the entire Swagger object ... but we help it out by providing the path
+      ;; to where the PathInfoObject (which describes what Rook calls a "route").
+      (pio-constructor swagger-options swagger-object routing-entry
+                       [:paths path-str method-str]))))
 
 (defn- routing-entry->map
   [[method path _ endpoint-meta]]

  (cond (s/optional-key? schema-key)
        [(.k schema-key) false]

        (s/required-key? schema-key)
        [(.k schema-key) true]

        (keyword? schema-key)
        [schema-key true]

        :else
        (throw (RuntimeException. (format "No idea what to do with query schema key %s." schema-key)))))

(defn default-query-params-injector
  "Identifies each query parameter via the :query-schema metadata and injects it."
  [swagger-options swagger-object routing-entry params-key]
  (if-let [schema (-> routing-entry :meta :query-schema)]
    ;; Assumes that the schema is a map.
    (try
      (let [reducer (fn [so [key-id key-schema]]
                      (cond-let
                        ;; Just ignore these, they are a convinience for the caller ("be generous in what you accept").
                        (= s/Any key-id)
                        so

                        [[k required] (reduce-schema-key key-id)]

                        :else
                        (update-in so params-key
                                   conj {:name     k
                                         :in       :query
                                         :required required})))]
        (reduce reducer swagger-object schema))
      (catch Exception e
        (throw (ex-info "Unable to convert routing entry into Swagger data."
                        routing-entry
                        e))))
    ; no :query-schema
    swagger-object))

(defn schema->swagger-schema
  [swagger-options schema]
  ;; To be done!
  (medley/remove-vals nil?
                      {:required    []
                       ;; :description is often provided by with-description, which overrides the normal docstring.
                       :description (or (-> schema meta :description)
                                        (-> schema meta :doc))
                       :properties  {}}))

(defn to-schema-reference
  "Converts a schema to a schema reference; the schema must be named.  Returns a tuple

  Adapter for ring-swagger. Converts an intermediate description of the namespaces
  into a description compatible with the ring-swagger library."
  (:require [schema.core :as s]
            [io.aviso.rook.schema :refer [unwrap-schema]]
            [clojure.string :as str]
            [medley.core :as medley]
            [io.aviso.toolchest.macros :refer [cond-let]]
            [io.aviso.toolchest.collections :refer [pretty-print]]
            [io.aviso.tracker :as t]
            [clojure.tools.logging :as l]
            [io.aviso.rook.utils :as utils])
  (:import [schema.core EnumSchema Maybe]
           [io.aviso.rook.schema IsInstance]))

(defn- remove-nil-vals
  [m]
  (medley/remove-vals nil? m))

(defn- remove-any-keys
  "Removes keys that are equaly to s/Any."
  [m]
  (medley/remove-vals #(= s/Any %) m))

(def default-swagger-skeleton
  "A base skeleton for a Swagger Object (as per the Swagger 2.0 specification), that is further populated from Rook namespace
