Skip to content

Validate active job pagination parameters - #869

Open
codingkiddo wants to merge 1 commit into
Netflix:masterfrom
codingkiddo:fix/validate-pagination-parameters
Open

Validate active job pagination parameters#869
codingkiddo wants to merge 1 commit into
Netflix:masterfrom
codingkiddo:fix/validate-pagination-parameters

Conversation

@codingkiddo

Copy link
Copy Markdown

Context

The activeJobOverview endpoint accepts optional startingIndex and pageSize query parameters.

Previously, these values were converted directly using Integer.parseInt. Invalid values such as negative integers, non-numeric strings, empty values, or values exceeding the integer range could either be passed to the resource-cluster layer or result in an internal server error.

This change validates both pagination parameters before invoking the underlying service.

Invalid values now return 400 Bad Request with a clear error message:

  • startingIndex must be a non-negative integer
  • pageSize must be a non-negative integer

The change also preserves pageSize=0 as a valid value.

Changes

  • Added validation for startingIndex and pageSize.
  • Rejected negative, non-numeric, empty, and overflowing integer values.
  • Added clear client-facing validation messages.
  • Added tests covering invalid pagination parameters.
  • Added a regression test for a negative startingIndex.
  • Added coverage confirming that pageSize=0 remains valid.
  • Verified that invalid requests do not reach the resource-cluster layer.

Checklist

  • ./gradlew build compiles code correctly
  • Added new tests where applicable
  • ./gradlew test passes all tests
  • Extended README or added javadocs where applicable

README and Javadoc changes are not applicable because this change only validates existing API parameters and does not introduce a new public API.

Signed-off-by: Vinod Kumar <codingkiddo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant