Fork me on GitHub
#clojure-spec
<
2018-10-26
>
bbrinck00:10:12

If you’ve run into “Cannot convert path” errors with Expound (which happens if you use a spec with a conformer), please try out 0.7.2-SNAPSHOT and let me know what you think

richiardiandrea02:10:56

Will try that out thanks a lot for the fix!

borkdude08:10:27

(s/fdef foo
    :args (s/cat :n number?)
    :ret string?)

  (defn foo [n]
    1)

  (s/conform (:ret (s/get-spec `foo)) 1) ;; :clojure.spec.alpha/invalid
  (s/assert (:ret (s/get-spec `foo)) 1) ;; 1 

borkdude08:10:37

why does the assert not throw there?

mpenet09:10:42

you prolly need to enable asserts

mpenet09:10:52

(s/check-asserts true)

mpenet09:10:07

by default they are compiled in but not enabled

mpenet09:10:39

for debugging (and because I am lazy) I sometimes use s/assert*, it bypasses the various flags

mpenet09:10:50

but that's hairy territory

gfredericks11:10:06

why does stest/check take symbols instead of vars? it doesn't require code for you does it?

asilverman23:10:28

Hi there clojurians, I am looking for some help regarding the use of clojure.spec.alpha. Basically I would like to verify that a map of key-value pairs i receive as an argument is a sub set of a well defined group. For example let the group of valid keys be :key1 :key2. I would like my spec to conform if I get a map with en empty amount of keys, or with either :key1 exclusively or :key2 exclusively or both :key1 and :key2 exclusively. I’m confused about how to specify this