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

Missing generator for (schema/both ...) #20

Open
dfrese opened this issue Jan 29, 2020 · 1 comment
Open

Missing generator for (schema/both ...) #20

dfrese opened this issue Jan 29, 2020 · 1 comment

Comments

@dfrese
Copy link

dfrese commented Jan 29, 2020

A geneator for (both ...) schemas seems to be missing:

Execution error (IllegalArgumentException) at schema-generators.generators/eval11171$fn$G (generators.cljc:56).
No implementation of method: :composite-generator of protocol: #'schema-generators.generators/CompositeGenerator found for class: schema.core.Both

Schema library version "1.1.12" was used.

@gfredericks
Copy link
Contributor

both is thorny because you can't reasonably make a generator that's guaranteed to succeed. One approach is to generate something from the first generator, use gen/such-that to filter based on matching the second generator, and risk throwing an exception if it can't succeed.

That puts the burden on the user to understand that implementation and possibly have to fall back to custom generators.

I'm not saying it shouldn't be done, it's just a less obvious design choice than most other schema->gen implementations.

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

No branches or pull requests

2 participants