Fork me on GitHub
#clojure-spec
<
2020-07-16
>
kenny16:07:02

Are there some cases where the generator override passed to st/check will not actually be the generator used? I seem to be hitting a case like this. I do see this note in the docstring for s/gen "Note that parent generator (in the spec or overrides map) will supersede those of any subtrees." I'm not sure if this is relevant here. It's also not totally clear what "parent generator" means in this case.

Alex Miller (Clojure team)16:07:52

I believe there are some cases where this doesn't work. the note is talking about recursive cases I think

Alex Miller (Clojure team)16:07:22

iirc one common issue in this area is with aliased specs

kenny16:07:44

Aliased specs?

kenny16:07:03

i.e., (s/def ::parent ::child) ?

kenny16:07:14

Yep, this is definitely an aliased spec

kenny16:07:49

Guessing this fix will be to use the alias.

kenny16:07:08

Not exactly a fit but I think it'll work in my case.

kenny16:07:49

fwiw, my usage here is really a workaround to selecting which (deeply nested) keys are required for a test 🙂