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

Fix for Boolean Pointer Field Validation Error #240

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Fix for Boolean Pointer Field Validation Error #240

merged 3 commits into from
Nov 30, 2023

Conversation

kaptinlin
Copy link
Contributor

Problem:

Issue #239 highlighted a validation error that occurs with structs containing boolean pointer fields. When a boolean value is assigned to these fields, an erroneous error message is generated, stating that a boolean value must be provided.

Changes:

In this pull request, we have addressed this issue by refining the validation logic to correctly process boolean pointer fields. This ensures that assigned boolean values, including false, are appropriately validated without generating incorrect error messages.

Verification:

The implemented fix has been verified with various scenarios to ensure the validation error is resolved, and the validation process works as intended.

Additional Context:

This enhancement ensures that validation is consistent and accurate when dealing with boolean pointer fields, providing reliable outcomes for all future validations.

@coveralls
Copy link

coveralls commented Oct 7, 2023

Pull Request Test Coverage Report for Build 7033770324

  • 36 of 37 (97.3%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 96.19%

Changes Missing Coverage Covered Lines Changed/Added Lines %
util.go 19 20 95.0%
Totals Coverage Status
Change from base Build 6541589985: 0.1%
Covered Lines: 2878
Relevant Lines: 2992

💛 - Coveralls

@kaptinlin
Copy link
Contributor Author

These commits addresses the issue reported in #248 by enhancing the gookit/validate package's ability to handle and validate pointer variables. Previously, validations on pointers, especially for primitive types like strings and integers, did not correctly dereference the pointers to validate the underlying values. This update introduces changes to enable direct validation of pointer variable values.

Key Improvements:

  1. Pointer Support: The validation logic has been expanded to include proper handling and dereferencing of pointer variables. This allows for direct validation of the values pointed to by these variables.

  2. Comprehensive Testing: New test cases have been added to cover the validation of pointer variables. These tests ensure that both string and integer pointers are correctly validated, maintaining the robustness of the package.

  3. Maintaining Code Integrity: Care has been taken to ensure that these changes are consistent with the existing coding standards and practices within the gookit/validate package.

By introducing these enhancements, the package now offers more flexible validation options, catering to a broader range of use cases involving pointer variables. The implementation ensures that validations are correctly performed on the actual values, thus improving the reliability and functionality of the package.

I welcome any feedback or suggestions on this pull request.

@inhere inhere added the enhancement New feature or request label Nov 30, 2023
@inhere inhere merged commit 8c4d6aa into gookit:master Nov 30, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants