 
 (defn document [document]
   (-> document
-      (->> (s/validate document-result))
+      (validate document-result)
       json/write-str
       response/response
       (response/status 200)


(defn document-stash [stash-result]
  (-> {}
      (->> (s/validate document-stash-result))
      json/write-str
      response/response
      (response/status 204)


(def document-result {:document s/Str})

(defn validate [data schema] (s/validate schema data))

;;; TODO: need an index json doc to bootstrap ui from

;;; TODO: we output in latin 1 (on my mac anyway, maybe default
;;; encoding?!). This is added to the content-type presumably by ring?

(defn exception [ex]
  (-> {:msg (.getMessage ex)}
      (validate error-result)
      json/write-str
      response/response
      (response/status 500)
