-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add additional validation rules #3
Comments
@brendt - it might be helpful to flesh out exactly which rules we'd need to see in place before v1. Gives people something to work toward. 🙂 |
I'll draft a list later today or tomorrow :) |
@brendt - I'm thinking we should update the rule interface to simply accept the object under validation as an additional parameter. Any reason you can think of not to do this vs. something like a separate data aware interface like Laravel has? |
Do you have an example of when it might be useful? My intention for validation rules was that they would be an extension on PHP's type system without the need for any additional context. But I'm open for exploring alternatives |
The |
@brendt - I am going to expand your list every time we get close to finishing it. 😉 |
Btw, if |
Alpha / AlphaNumeric were added in #69. |
@brendt - should Tempest be supporting conditional validation rules? For example, if I want the value to be a URL OR IP address? |
Not right now, I don't think it's needed for 1.0. |
@brendt PasswordNotCompromised - Checks the password against haveibeenpwned |
I believe it's indeed a request to haveibeenpwned. We can always look at how Laravel and Symfony implement those rules, to be sure. The question about which HTTP client to use is actually an interesting one. I'm sure we shouldn't use curl directly, so maybe guzzle; but I really dislike the overhead that comes with PSR support in guzzle. Maybe let's not work on this rule until we've figured out which HTTP client we want to use throughout Tempest. |
Would you consider doing Msisdn validation? Phone numbers are as commonly used as email. I'd like to create that validation, If you consider to add. |
@omerimzali I believe this is covered by the PhoneNumber rule, no? |
@aidan-casey Yes you're totally right. I was mistaken as I was searching for the term "msisdn validator". |
@omerimzali - Perfect! I will try to remember mentioning MSISDN in the docs so it is easily searchable. 🙂 |
See more details here on the API for checking password hashes.
I think this is an accurate thought. 🙂 |
I think this one is ready to be closed 🥳 Thanks a lot to everyone helping out! |
…mistyped-commands feat: Suggests corrections for mistyped commands
Each of these rules should implement the
Rule
interface, and have a test to validate it works as expected. Keep in mind that Tempest relies on PHP's type system for rudimentary validation like required, nullable, and type. These shouldn't be validation rules.true
value. (Add ShouldBeTrue and ShouldBeFalse validation rules #64)false
value (Add ShouldBeTrue and ShouldBeFalse validation rules #64)Date — a valid datewe can use DateTimeFormat?PasswordNotCompromised - Checks the password against haveibeenpwnednot right nowSameAs — this value should be the same as another value, for example for password validationskip for now since Rules aren't aware of their larger context.The text was updated successfully, but these errors were encountered: