Fork me on GitHub
#clojure-spec
<
2016-10-18
>
ewen11:10:44

Hi, some spec descriptions return fully qualified symbols while others don't

ewen11:10:03

For example (s/form (s/every string?)) => (clojure.spec/every string? ...) (s/form (s/tuple string?)) => (clojure.spec/tuple clojure.core/string?)

ewen11:10:36

is this the expected behavior ?

alexmiller12:10:18

No and I am working on fixing all of those right now

ewen12:10:21

ok thank you !

decoursin19:10:47

Is there a way to stub clojure.spec.test/check?

decoursin19:10:50

(clojure.spec.test/check `foo {:stub #{`bar}}) 
doesn't work

donaldball20:10:03

Has anyone used clojure.spec at runtime, e.g. to validate the arguments of fns at system boundaries?

seancorfield20:10:34

Yes, that’s how we use it @donaldball

donaldball20:10:28

What’s your technique? Do you instrument the namespaces or fns about which you care, or manually check the args using a precondition or e.g. a custom defn macro?

alexmiller20:10:09

@decoursin do that with instrument prior to the call to check

seancorfield20:10:48

@donaldball We explicitly call conform and see whether we get invalid? data back, since we need to map to a set of known error codes that our API returns.

seancorfield20:10:30

In a couple of places we use explain-data to help figure out which error code to return (but most are simply "parameter X was not valid").

seancorfield20:10:51

Most of our specs are data structure specs. We have some function specs. We call instrument when we’re testing, and we have a few places where we run check explicitly as well. Mostly we’ve been doing the latter manually (in the REPL) so far.