-
Notifications
You must be signed in to change notification settings - Fork 162
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
Enable user defined Validations #449
Comments
Ah. I see. We cannot use But, can we remove the |
Because we want to be able to serialize validations, a better approach is to define a new type of predicate which we can add to validation inside this library (rather than support user-defined validation). What sort of validation did you want to add? |
Another possibility is to allow conversion of ZIO Schema Validation into ZIO Prelude Validation (which is possible). |
This issue is affecting us right now as well. Trying to set up a Password validation and we're having to remap all the errors to hide the password in messages.
I see that the goal is to serialize validations. In this case, I doubt it would be possible to create a custom validation...
I'd be happy to make this happen. We actually started validating things with zio-prelude's Validation type and found it to be quite handy. Ideally for us, it becomes possible to both create our own instance of I can work on this if there's some outcome where failures are customized (which seems like it would be possible to serialize if the values are strings). |
Use case
I want to use
zio.schema.annotation.validate
annotation to validate a field of a case class.Problem
To do so, I have to provide an instance of
Validation
:ex,
Validation(Bool.Leaf(myPredicate))
But
zio-schema
does not provide a way to create customPredicate
(and so customValidation
)My question
Can
zio-schema
usezio.prelude.Validation
instead ofzio.prelude.Validation
?(
zio-schema
is already depended onzio-prelude
)Relates
If we permit user to define custom validation then issues like #251 will automatically be resolved.
The text was updated successfully, but these errors were encountered: