clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
kenny 2020-07-16T16:12:02.493900Z

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.

alexmiller 2020-07-16T16:14:52.494700Z

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

alexmiller 2020-07-16T16:15:22.495300Z

iirc one common issue in this area is with aliased specs

kenny 2020-07-16T16:15:44.495600Z

Aliased specs?

kenny 2020-07-16T16:16:03.496Z

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

ghadi 2020-07-16T16:16:06.496200Z

yeah

kenny 2020-07-16T16:17:14.497Z

Yep, this is definitely an aliased spec

kenny 2020-07-16T16:17:49.497300Z

Guessing this fix will be to use the alias.

kenny 2020-07-16T16:18:08.497700Z

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

kenny 2020-07-16T16:19:49.498600Z

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