Hi,
I’m trying to validate the contents of a set for output options.
It may contain :csv
and/or :xlsx
.
When I try
> (require '[clojure.spec.alpha :as spec])
> (spec/explain (spec/+ #{:csv :xlsx}) #{:any})
#{:any} - failed: (or (nil? %) (sequential? %))
it fails since a set (#{:any} here)
in not sequential.
>(spec/explain (spec/+ #{:csv :xlsx}) (seq #{:any}))
:any - failed: #{:csv :xlsx} in: [0]
works since we made it sequential.
Is this expected behaviour, or a bug in spec?
Since I want to combine this spec with others,
the fix above does not work any more
(spec/and (spec/coll-of keyword? :kind set?)
(spec/+ #{:csv :xlsx}))
Are there better ways to validate set elements?
Thanks
Lothar
P.S.: spec/* and spec/? show the same “problem”