-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add relations validation in get and search requests #211
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
feat: add relations validation in get and search requests #211
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 adds validation for relation names in get and search requests by introducing a getAvailableRelations() method that returns a whitelist of allowed relations. The validation rule uses Laravel's in: validator to ensure only specified relations can be requested through the with parameter.
- Adds
getAvailableRelations()method to define allowed relations - Updates validation rules for
with.*parameter to usein:validator - Includes a TODO comment reminding developers to review the relations list
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| stubs/request.blade.php | Template updated to conditionally include relation validation logic and the getAvailableRelations() method |
| src/Generators/RequestsGenerator.php | Generator logic updated to detect with.* parameter and add in: rule for validation |
| tests/fixtures/RequestGeneratorTest/search_request.php | Test fixture showing expected output with relation validation for search requests |
| tests/fixtures/RequestGeneratorTest/get_request.php | Test fixture showing expected output with relation validation for get requests |
| tests/fixtures/CommandTest/search_request_subfolder_model.php | Test fixture for subfolder model scenario with relation validation |
| tests/fixtures/CommandTest/search_request.php | Test fixture for basic search request with relation validation |
| tests/fixtures/CommandTest/get_request.php | Test fixture for basic get request with relation validation |
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…-and-SearchRequest-
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
refs: #206