Fork me on GitHub
#clojure-spec
<
2018-05-20
>
karol.adamiec15:05:56

in clojurescript/javascript when i get json on the wire with UUID as a string, how should i spec that? uuid? passes even with empty string, (but has a correct genereator). I want the spec to be used as a tool for dev time to quickly catch misbehaving API’s. Also want to generate sample data for unit tests. (ie javascript harness reads a file generated by simple clojurescript spec gen and runs a suite of tests for each generated input. i could swap / regenerate entry fixtures as i see fit…)

nenadalm05:05:42

any predicate can be used to spec value: https://clojure.org/guides/spec#_predicates

nenadalm05:05:14

You can write custom generator if existing ones are not good enough for you: https://clojure.org/guides/spec#_custom_generators