     ; no schema:
     swagger-object))
 
+(defn default-responses-injector
+  "Uses the :responses metadata to identify possible responses."
+  [swagger-options swagger-object routing-entry paths-key]
+  (let [responses (-> routing-entry :meta :responses)
+        reducer (fn [so [status-code schema]]
+                  (let [schema-meta (meta schema)
+                        description (or (:description schema-meta)
+                                        (:doc schema-meta)
+                                        "Documentation not provided.")]
+                    (assoc-in so (concat paths-key [:responses (str status-code)]) {:description description})))]
+    (reduce reducer swagger-object responses)))
+
 (defn default-path-item-object-injector
   "Injects a PathItemObject based on a routing entry.
 
   The paths-key is a coordinate into the swagger-object where the PathItemObject should be created.
 
-  Returns the modified swagger-object. "
+  Returns the modified swagger-object."
   [swagger-options swagger-object routing-entry paths-key]
   (let [{endpoint-meta :meta} routing-entry
         swagger-meta (:swagger endpoint-meta)

        path-params-injector (:path-params-injector swagger-options default-path-params-injector)
        query-params-injector (:query-params-injector swagger-options default-query-params-injector)
        body-params-injector (:body-params-injector swagger-options default-body-params-injector)
        params-key (concat paths-key ["parameters"])]
    (as-> swagger-object %
          (assoc-in % paths-key

                                   :required :true}))]
    (reduce reducer swagger-object path-ids)))

(defn reduce-schema-key
  "Simplifies a key from a schema reducing it to a keyword, and whether the key is required or optional."
  [schema-key]
  (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))

