Skip to content

Comments

[Java] Implement effective pagination for GET /v1/lamps#380

Merged
davideme merged 3 commits intomainfrom
codex/issue-374-java-pagination
Feb 16, 2026
Merged

[Java] Implement effective pagination for GET /v1/lamps#380
davideme merged 3 commits intomainfrom
codex/issue-374-java-pagination

Conversation

@davideme
Copy link
Owner

Summary

  • wire cursor and pageSize through Java GET /v1/lamps
  • return bounded pages with correct hasMore and nextCursor
  • align in-memory paged reads with DB semantics (active-only and deterministic ordering)
  • add controller/service/repository tests for pagination behavior

Notes

  • invalid cursor now falls back to first page (offset 0)
  • terminal pages omit nextCursor

Closes #374

Copilot AI review requested due to automatic review settings February 16, 2026 13:02
Copy link
Contributor

Copilot AI left a 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 implements effective pagination for the Java GET /v1/lamps endpoint, ensuring list responses are bounded and cursor/pageSize parameters are properly honored. The implementation aligns with the parent issue #372's goal of optimizing API performance by preventing unbounded responses.

Changes:

  • Added offset-based cursor pagination with configurable page size (default 25)
  • Implemented deterministic ordering (by createdAt, then by id) for consistent pagination
  • Ensured in-memory repository behavior matches database semantics (active-only filtering and stable sort order)
  • Added comprehensive test coverage for pagination scenarios including edge cases

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/java/src/main/java/org/openapitools/controller/LampsController.java Updated listLamps endpoint to parse cursor parameter, call paginated service method, and build response with hasMore/nextCursor fields
src/java/src/main/java/org/openapitools/service/LampService.java Added PagedLampsResult record and findAllActivePage method with OffsetBasedPageRequest implementation for cursor-based pagination
src/java/src/main/java/org/openapitools/repository/impl/InMemoryLampRepository.java Updated findAll(Pageable) to filter deleted lamps and sort by createdAt+id for consistency with JPA implementation
src/java/src/test/java/org/openapitools/controller/LampsControllerTest.java Added tests for paginated responses, terminal pages, and invalid cursor handling
src/java/src/test/java/org/openapitools/service/LampServiceTest.java Added tests for hasMore/nextCursor logic, terminal pages, and pageSize validation
src/java/src/test/java/org/openapitools/repository/LampRepositoryTest.java Added tests for active-only filtering and deterministic ordering in paginated queries

@davideme
Copy link
Owner Author

Checked all PR feedback surfaces (issue comments, review comments, and review threads). There are currently no actionable comments to address on this PR.\n\nI already pushed follow-up fixes for SpotBugs and PMD in commits f13b72b and 2618780.

@davideme davideme merged commit 6a7c3be into main Feb 16, 2026
4 checks passed
@davideme davideme deleted the codex/issue-374-java-pagination branch February 16, 2026 15:32
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.

[Java] Implement effective pagination for GET /v1/lamps

1 participant