Fork me on GitHub

any advice in how to create a spec for a "string-date" where the string should be a valid RFC3339 format?

Mikko Harju10:05:54

Hi! Is there a mechanism to get exhaustive errors from a spec or how would one approach validating maps with required keys and keys that depend on the content of another one? For instance, given a spec like

(s/and (s/keys :req-un [::start-date ::end-date ::foo]) end-date-after-start-date?)
I’d like to be able to have the end-date-after-start-date? error to be shown also when the key :foo is also missing from the map.

Mikko Harju10:05:23

By default s/and does short circuiting on the first failing spec

Mikko Harju10:05:09

One option would be to split the spec and use s/merge, are there any other valid options?

Jakub Holý (HolyJak)11:05:53

Any idea why, given this spec

(s/def ::account (s/with-gen delay? (constantly (sg/return (delay nil)))))
does (sg/sample (s/gen ::account)) fail with > Unable to construct gen at: [] for: :myapp/account ? Doesn't the with-gen add the generator?