-
Notifications
You must be signed in to change notification settings - Fork 97
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
Implement the custom format validator #51
Implement the custom format validator #51
Conversation
Sounds like a great idea! I will have a look at the PR later today and give some feedback. |
As there is no room in the error struct for custom messages, we can have the function just return a boolean.
The potential issue I see with this solution that it's using the Application environment. Meaning that when two independent parts of the project use a custom format validator, they need to ensure that they reach agreement of the callback module to use. A better solution would be to add an extra |
Yes, good point. Another option would be to put the format validator in the |
So a great approach would be to (optionally) pass configuration options to |
9b9c758
to
bd2cb72
Compare
I force-pushed to remove my last commit which made the return value "nicer", so now the validator should return a list of errors again. I agree that passing down a format validator inside the struct would be nice, but it's additional to this PR, I'll create a ticket for it after this is merged. |
Ah, sorry, that was a misunderstanding. I prefer the version you had in the end, where the format validator function just returns a boolean. I should have phrased that comment a bit more clearly. Any comments on the idea of putting the custom format validator in the schema struct? |
Oh, hah, oops :-) Git reflog ftw, I've pushed again. About the custom format validator, I think it could be stored in the |
But like I said maybe it's better to do that in a separate PR. |
Ok, that makes sense. I will merge and release the current state. Thank you for the excellent work 👍 |
Thanks! |
Just released on Hex as well as version |
See #50