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 has_validator and has_filter method #348

Conversation

chaungoclong
Copy link

This method checks if a validator method exists for a given rule.

The reason for adding this method is to prevent exceptions from being thrown when using the add_validator method with a rule that already exists. By using has_validator, we can ensure that a rule does not exist before adding it.

Here are the key changes:

  1. New Method: The has_validator method takes a rule as a string parameter and returns a boolean value. It checks if a validator method exists for the given rule in the Validator class or if the rule is present in the validation_methods array.

  2. Test Cases: Test cases for both happy and unhappy paths have been included to validate the functionality of the new has_validator method.

@filisko
Copy link
Collaborator

filisko commented Apr 14, 2024

Hi @chaungoclong . Perhaps has_filter would be also nice to add?

@chaungoclong
Copy link
Author

Hi @filisko , Thanks for the suggestion! I can add the has_filter method in this pull request along with has_validator. I'll get started on it.

@filisko filisko changed the title Add has_validator method Add has_validator and hasd_filter method Apr 29, 2024
@filisko filisko changed the title Add has_validator and hasd_filter method Add has_validator and has_filter method Apr 29, 2024
@filisko
Copy link
Collaborator

filisko commented Apr 29, 2024

Added more stuff here #351

@filisko filisko closed this Apr 29, 2024
filisko added a commit that referenced this pull request Apr 29, 2024
* add has_validator method

* add has_filter method

* Add more test cases and update README.md

---------

Co-authored-by: Dragon <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants