Add pagination and tighten API boundaries - #6
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the process-check API to return bounded, pageable list responses with stable page metadata, while tightening persistence/API constraints and adding lightweight operational logging.
Changes:
- Switch list endpoint + service/repository to Spring Data
Pageableand returnPagedModelinstead of serializingPageImpl. - Align validation and database constraints by capping
processName/ownerto 120 chars and enforcing max page size of 100. - Add write-operation logging and extend integration tests + docs to reflect pagination and constraints.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/de/datatidehh/processapi/processcheck/ProcessCheckApiIntegrationTests.java | Updates list assertions for paged responses and adds validation tests for oversized fields. |
| src/main/resources/application.properties | Configures Spring Data web pageable max page size. |
| src/main/java/de/datatidehh/processapi/processcheck/ProcessCheckService.java | Adds pageable query support, relies on dirty checking for updates, and logs create/update/delete operations. |
| src/main/java/de/datatidehh/processapi/processcheck/ProcessCheckRequest.java | Enforces max-length validation for processName and owner. |
| src/main/java/de/datatidehh/processapi/processcheck/ProcessCheckRepository.java | Updates repository query method to return Page and accept Pageable. |
| src/main/java/de/datatidehh/processapi/processcheck/ProcessCheckController.java | Exposes pageable list endpoint and returns PagedModel responses with default sorting. |
| src/main/java/de/datatidehh/processapi/processcheck/ProcessCheck.java | Aligns entity schema with API constraints (nullability + column lengths). |
| README.md | Documents pagination, response shape, logging, and updated validation constraints. |
| docs/index.md | Updates project page to reflect paginated API behavior and constraints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| spring.jpa.show-sql=false | ||
| spring.jpa.open-in-view=false | ||
|
|
||
| spring.data.web.pageable.max-page-size=100 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a00e476c12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? repository.findAll(pageable) | ||
| : repository.findAllByStatus(status, pageable); |
There was a problem hiding this comment.
Validate pageable sort fields before querying
When a caller supplies an unsupported sort key, such as sort=process_name,asc or any typo, the Pageable is passed straight into Spring Data JPA and the repository tries to resolve that value as an entity property path. Because the app only handles not-found exceptions explicitly, this invalid client input propagates as a server error instead of the expected 400-style API boundary; please whitelist allowed sort fields or translate invalid sort properties before calling the repository.
Useful? React with 👍 / 👎.
What changed
PagedModelresponses instead of serializingPageImpldirectlyprocessNameandownerto 120 characters in both request validation and JPA columnsWhy
The API previously returned every matching row and did not align text-length validation with the generated database schema. This keeps the project compact while making its list behavior, persistence constraints and operational logging more deliberate.
Review notes
The logging intentionally excludes full request bodies and read requests. Pagination uses Spring Data's lightweight
PagedModel; no custom response framework or additional abstraction was introduced.Validation
GitHub Actions runs the repository's Java 21 Maven Wrapper command:
./mvnw --batch-mode --no-transfer-progress clean verify.