-
-
Notifications
You must be signed in to change notification settings - Fork 24
fix(ValidateOrFail): Handle filtering nested structs and arrays #85
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the validateOrFail
method to properly filter nested structs and arrays, ensuring that only keys matching validation constraints are returned at all levels of the data structure. Previously, filtering only applied to top-level keys.
Key changes:
- Refactored the filtering logic in
ValidationManager.cfc
to handle nested structures recursively - Added comprehensive tests for nested struct and array filtering scenarios
- Updated test handler with a new endpoint to test nested validation filtering
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
models/ValidationManager.cfc | Extracted filtering logic into a recursive private method that handles nested structs and arrays |
test-harness/handlers/Main.cfc | Added new test endpoint with nested constraints and code formatting improvements |
test-harness/tests/specs/ValidationIntegrations.cfc | Added comprehensive test case for nested struct and array filtering validation |
The failing test seems due to testing using ColdBox which is not yet BoxLang Prime certified. |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
Co-authored-by: Copilot <[email protected]>
Description
When using
validateOrFail
, the top level keys of the struct are filtered to only return the keys matching a constraint. This has not applied to nested structs and arrays. This PR fixes that behavior.Issues
https://ortussolutions.atlassian.net/browse/BOX-161
Type of change
Please delete options that are not relevant.
Checklist