Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated sets of :ref are always empty #427

Closed
helins opened this issue Apr 27, 2021 · 2 comments · Fixed by #429
Closed

Generated sets of :ref are always empty #427

helins opened this issue Apr 27, 2021 · 2 comments · Fixed by #429

Comments

@helins
Copy link
Contributor

helins commented Apr 27, 2021

Sets that contains a :ref are always generated empty, for example:

(malli.gen/sample [:set
                   {:registry {::foo :int}}
                   [:ref ::foo]])

No such problem with :vector. I tried a couple other ways in my (more complex) use case but it always boils down to this fact.

@ikitommi
Copy link
Member

:set uses different function for generating values, if you can see what is wrong in the -coll-distict-gen compared to -coll-gen, PR most welcome:

https://github.com/metosin/malli/blob/master/src/malli/generator.cljc#L49-L70

@ikitommi
Copy link
Member

(there is a fishy if with :ref...)

helins added a commit to helins/malli that referenced this issue Apr 27, 2021
Comparing `-coll-gen` and `-coll-gen-distict` in the `malli.generator`
namespace, it seems there was no reason for the latter to handle
recursive generation any different. Both implementations now create a
generator based on the same initial conditions.
@helins helins mentioned this issue Apr 27, 2021
ikitommi added a commit that referenced this issue Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants