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

Allow for overriding the default Gen instance used for a type in zio-schema-zio-test #438

Open
beem812 opened this issue Nov 21, 2022 · 0 comments

Comments

@beem812
Copy link
Contributor

beem812 commented Nov 21, 2022

Current behavior:
Gen instances for a string are automatically set to Gen.anyString

Problem:
Gen.anyString can produce a character that postgres doesn't like, \u0000, which causes tests against a postgres db to randomly fail and do so extremely rarely making it harder to debug the cause. The use of refined types would also be a use case for this, for instance something with a fairly specific string refinement is better served by starting with a string that closely matches the refinement rather than hoping you eventually get the right kind of string from Gen.anyString.

Solution:
Some way to implicitly override the string gen for anything else, or a way to bake in the generator I want into a schema that can be used in place of the string primitive schema. An annotation might be a good solution.

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

1 participant