Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using pretty-spec/pprint instead of clojure.pprint/pprint to pprint specs #14

Open
jpmonettas opened this issue Aug 10, 2017 · 5 comments

Comments

@jpmonettas
Copy link

Maybe https://github.com/jpmonettas/pretty-spec can help pprinting specs more similar to what you would write by hand.

@stathissideris
Copy link
Owner

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.

@jpmonettas
Copy link
Author

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)
                                                 

@stathissideris
Copy link
Owner

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!

@marco-m
Copy link
Contributor

marco-m commented Feb 15, 2018

@stathissideris any news ?

@stathissideris
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants