Fork me on GitHub
#clojure-spec
<
2022-06-14
>
Drew Verlee18:06:53

I don't understand what spec is trying to tell me here. Isn't {:keys ... valid clojure?

-- Spec failed --------------------

  (... ... [{:keys [http-client max-retries backoff retry?], :as client} ...] ...)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

should satisfy

  vector?

-- Relevant specs -------

:clojure.core.specs.alpha/arg-list:
.... (more spec info...)

Victor Maia Aldecôa18:06:13

I don't understand either, but you can try to use this lib to get better spec messages: https://github.com/bhb/expound

Drew Verlee18:06:36

that is expound formatted 🙂

picard-facepalm 1
😅 1
Alex Miller (Clojure team)18:06:04

Do you have the message without expound?

cjohansen18:06:14

Throwing in a guess: maybe you forgot to put optional arguments in a vector? (defn blabla [a b & {:keys [c d]}] ,,,)

Drew Verlee20:06:08

i could go back and re-create the errors it if it helps. The minimal change that made the errors go away was to

(defn foo [{:keys [x] :or {::x "x"}] x) 
to
(defn foo [{:keys [x] :or {x "x"}] x) 
note the :or {::x to to just x. that is, the value of the hashmap of the :or arg has to be a symbol not a key. This same error seemed to generate several different expound messages (at least thats how it seems to me).

Alex Miller (Clojure team)20:06:50

the keys of :or are always the symbols being bound, which must be unqualified, so neither :x or ::x are valid in that spot

👍 2