Generated schemas with clojure.spec

2017-06-07 Thread Petr
Hello, I tried to use clojure.spec for validation and test data generation of requests for API described according OpenAPI (https://www.openapis.org/). My code reads an OpenAPI specification, then constructs description that can be used with clojure.spec. The idea was to validate a request map

Re: clojure.spec - Using :pre conditions (or not)?

2017-06-07 Thread Alex Miller
Preconditions are already assertions, so it makes more sense to use s/assert in your code body than in a precondition. On Wednesday, June 7, 2017 at 8:12:22 AM UTC-5, David Goldfarb wrote: > > One big downside of using s/assert in a precondition: It does not work > with (s/nilable ...) specs, s

Re: clojure.spec - Using :pre conditions (or not)?

2017-06-07 Thread David Goldfarb
One big downside of using s/assert in a precondition: It does not work with (s/nilable ...) specs, since s/assert returns valid values. I fell into this trap for a moment of head-scratching just now. On Wednesday, September 14, 2016 at 4:59:09 PM UTC+3, Alex Miller wrote: > > Another option tha