Skip to content

Modify search request generation template #194

@DenTray

Description

@DenTray

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?

  1. Verify that the rules method calls getOrderableFields from BaseRequest and uses its return value in the invalidation rule for the order_by field.

  2. Test with valid order_by values that are included in the list returned by getOrderableFields and confirm validation passes.

  3. Test with invalid order_by values not in the list and confirm validation fails with an appropriate error.

  4. Ensure that no errors or exceptions occur when getOrderableFields is called.

  5. Confirm that the change does not affect other validations or fields.


Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions