-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
What needs to be done?
Update the search request validation template to include an in rule for the order_by field. This in rule should dynamically validate that the value of order_by is one of the fields returned by the getOrderableFields method of the BaseRequestclass. The call to getOrderableFields must be made inside the rules method of the search request class to obtain the valid fields list for validation.
Expected Outcome
What is the expected result?
The search request validation will restrict the order_by field to only allow values that appear in the array returned by BaseRequest::getOrderableFields(). This prevents invalid order_by values from passing validation and ensures consistent ordering capabilities aligned with the base request's supported fields.
Verification Scenarios
How can this be tested?
Verify that the
rulesmethod callsgetOrderableFieldsfromBaseRequestand uses its return value in theinvalidation rule for theorder_byfield.Test with valid
order_byvalues that are included in the list returned bygetOrderableFieldsand confirm validation passes.Test with invalid
order_byvalues not in the list and confirm validation fails with an appropriate error.Ensure that no errors or exceptions occur when
getOrderableFieldsis called.Confirm that the change does not affect other validations or fields.