spec-provider
spec-provider copied to clipboard
Consider using pretty-spec/pprint instead of clojure.pprint/pprint to pprint specs
Maybe https://github.com/jpmonettas/pretty-spec can help pprinting specs more similar to what you would write by hand.
Does pretty-spec support shortening namespaces so that clojure.spec.alpha/fspec
becomes s/fspec
in the printout? This is useful if you want to paste the output back into your code.
Added that to version 0.1.3
user> (pspec/pprint (s/form 'clojure.core/let)
{:ns-aliases {"clojure.spec.alpha" "s"
"clojure.core.specs.alpha" "score"
"clojure.core" nil}})
; (s/fspec
; :args (s/cat :bindings :score/bindings :body (s/* any?))
; :ret any?
; :fn nil)
I've started using this in the latest master for function specs and it works pretty well, my own code still as to convert :foo/bar
to ::bar
when appropriate. I'll try it for "data" specs as well. Thanks!
@stathissideris any news ?
I've started testing pretty-spec in trace.clj
(the undocumented part of spec-provider that attempts to deal with inferring specs of functions - not ready yet). I thought that I would release both features together, but function specs are taking a little longer than I expected, so maybe it would be worth to go for pretty-spec independently. Thanks for reminding me!