Fork me on GitHub
#clojure-spec
<
2019-11-09
>
cddr17:11:35

I made a thing to capture one side of that constraint as part of a toolkit for generating test-data to match a SQL schema....

(defn string-up-to [max-len]
  (s/with-gen string?
    #(gen/fmap (fn [x] (apply str x))
               (gen/bind (s/gen (s/int-in 0 max-len))
                         (fn [size]
                           (gen/vector (gen/char-alpha) size))))))

bortexz20:11:43

Is there any way to add a docstring to specs?

bortexz23:11:03

Are there any plans to add it? I think it could be interesting to have docstring when using spec to model the domain of an application