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

DMP-4826: Return error when search does not meet minimum characters to prevent performance impacting queries from running #2687

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Ben-Edwards-cgi
Copy link
Contributor

@Ben-Edwards-cgi Ben-Edwards-cgi commented Mar 10, 2025

Links

Jira

Change description

Summary of Git Diff

The recent changes to the CaseControllerSearchPostTest.java, RequestValidator.java, and OpenAPI specifications introduce additional validation tests for the /cases/search endpoint. Specifically, the changes enforce minimum length requirements for several fields in the request body, ensuring they are between 3 and 2000 characters. These updates enhance the robustness of the API by preventing invalid requests from being processed.

Highlights

  • New Test Cases Added:

    • Tests to validate the length of event_text_contains, judge_name, defendant_name, and courthouse fields. Each must be at least 3 characters long.
    • Each test checks for a "400 Bad Request" response when the corresponding field is less than the required length.
  • Validation Rules Defined:

    • Updated OpenAPI specification to include minLength and maxLength constraints for:
      • courthouse
      • judge_name
      • defendant_name
      • event_text_contains
  • Code Adjustments:

    • Import of JSONAssert and MockMvcResultMatchers to support JSON response validation in test cases.
    • Minor formatting changes to ensure consistency, including the addition of newlines at the end of files where necessary.

This update aims to improve input validation and error handling for the API, enhancing overall reliability and user experience.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[X] No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants