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

Add additional validation rules #3

Closed
28 of 31 tasks
brendt opened this issue Jul 19, 2023 · 18 comments
Closed
28 of 31 tasks

Add additional validation rules #3

brendt opened this issue Jul 19, 2023 · 18 comments

Comments

@brendt
Copy link
Member

brendt commented Jul 19, 2023

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.

@aidan-casey
Copy link
Member

@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. 🙂

@brendt
Copy link
Member Author

brendt commented Feb 17, 2024

I'll draft a list later today or tomorrow :)

@aidan-casey
Copy link
Member

@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?

@brendt
Copy link
Member Author

brendt commented Feb 18, 2024

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

@aidan-casey
Copy link
Member

The SameAs rule will require the greater context of the object, unless you want to engage wizardry mode.

@aidan-casey
Copy link
Member

@brendt - I am going to expand your list every time we get close to finishing it. 😉

@brendt
Copy link
Member Author

brendt commented Feb 20, 2024

Btw, if SameAs is the only rule that requires context, then we should skip it for now. There are other solutions to solving it which are convenient enough.

@aidan-casey
Copy link
Member

Alpha / AlphaNumeric were added in #69.

@aidan-casey
Copy link
Member

@brendt - should Tempest be supporting conditional validation rules?

For example, if I want the value to be a URL OR IP address?

@brendt
Copy link
Member Author

brendt commented Feb 21, 2024

Not right now, I don't think it's needed for 1.0.

This was referenced Feb 21, 2024
This was referenced Feb 21, 2024
@brendt brendt added the 1.0 label Feb 24, 2024
@brendt brendt mentioned this issue Feb 24, 2024
@aidan-casey aidan-casey added this to the v1.0.0 milestone Feb 24, 2024
@omerimzali
Copy link

@brendt PasswordNotCompromised - Checks the password against haveibeenpwned
For this validation rule are you planning to send a request to haveibeenpwned? Or is there another solution to this issue, such as searching through a local list? If we need to make the request, would curl be appropriate? Or would you consider using Guzzle? The project has not used either of them before.

@brendt
Copy link
Member Author

brendt commented Feb 26, 2024

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.

@omerimzali
Copy link

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.

@aidan-casey
Copy link
Member

@omerimzali I believe this is covered by the PhoneNumber rule, no?

@omerimzali
Copy link

@aidan-casey Yes you're totally right. I was mistaken as I was searching for the term "msisdn validator".

@aidan-casey
Copy link
Member

@omerimzali - Perfect! I will try to remember mentioning MSISDN in the docs so it is easily searchable. 🙂

@aidan-casey
Copy link
Member

I believe it's indeed a request to haveibeenpwned

See more details here on the API for checking password hashes.

Maybe let's not work on this rule until we've figured out which HTTP client we want to use throughout Tempest.

I think this is an accurate thought. 🙂

@brendt
Copy link
Member Author

brendt commented Feb 29, 2024

I think this one is ready to be closed 🥳 Thanks a lot to everyone helping out!

@brendt brendt closed this as completed Feb 29, 2024
aidan-casey pushed a commit that referenced this issue Jun 1, 2024
…mistyped-commands

feat: Suggests corrections for mistyped commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants