Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clojure spec's missing piece
;; clojure.spec's missing piece, work in progress
;; this is only halfway done, somebody else will need to do the other 95%
'[clojure.spec :as s]
'[clojure.spec.test :as test])
(defn naive-english-explain
"Copy and paste this into your app. Figure out what it does by
trying it in production."
([] (naive-english-explain (ex-data *e)))
(let [p1 (-> spec-explain-data ::s/problems first)]
(str "\nThis value looks wrong:"
(pr-str (:val p1))
"\n\nIt should have matched the spec:\n\n\t"
(pr-str (:pred p1))
(s/assert (s/coll-of int?) [1 2 :blah])
(println (naive-english-explain))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment