It's a little tricky but you want:

(s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec ::columns)))

Here the args data is ([{:foo "some_t"}]) and while you have an s/cat for 
:args and an s/cat in ::columns, those will be combined into the same regex 
so that's basically the same thing as ::columns. You need to force a new 
level of regex context and the s/spec will do that.

On Thursday, May 26, 2016 at 4:32:52 AM UTC-5, Sven Richter wrote:
>
> Hi,
>
> I already asked this in the spec channel on slack, but got no response yet.
>
> I have this simple spec definition:
>
> (s/def ::foo string?)
>
> ​
>
> (s/def ::column (s/keys :req-un [::foo]))
>
> ​
>
> (s/def ::columns (s/cat :col (s/* (s/spec ::column))))
>
> ;(s/def ::columns (s/cat :col (s/* ::column)))
>
> ​
>
> (defn remove-autoinc-columns [cols]
>
>   (vec (remove #(= true (:autoinc %)) cols)))
>
> ​
>
> (s/fdef remove-autoinc-columns :args (s/cat :cols ::columns)
>
>         :ret ::columns)
>
> ​
>
>
> $(remove-autoinc-columns [{:foo "some_t"}])
>
> ===> ExceptionInfo Call to #'de.sveri.clospcrud.s-play/remove-autoinc-columns 
> did not conform to spec:
>
> At: [:args] val: ([{:foo "some_t"}]) fails predicate: (cat :cols 
> :de.sveri.clospcrud.s-play/columns),  Extra input
>
> :clojure.spec/args  ([{:foo "some_t"}])
>
>   clojure.core/ex-info (core.clj:4617)
>
>
> On the other hand, running this:
> (s/conform ::columns [{:foo "some_t"}])
> => {:col [{:foo "some_t"}]}
> works.
>
> So something is broken within the fdefs argument definition.
>
> I dont see my mistake here, can somone else reproduce / fix this?
>
> Thanks,
> Sven
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to