Skip to content

Conversation

Ludy87
Copy link
Contributor

@Ludy87 Ludy87 commented Sep 6, 2025

Description of Changes

  • What was changed

    • Added explicit @ApiResponses for filter endpoints with 200 (PDF passed) and 204 (did not pass) including @Content and media types.
    • Replaced ambiguous null returns with ResponseEntity.noContent().build() when a filter condition is not met.
    • Ensured PDDocument is properly closed using try-with-resources in relevant endpoints.
    • Consolidated comparison logic into a reusable, type-safe compare<T extends Comparable<T>>() helper for page count, page size, file size, and rotation checks.
    • Minor cleanup and consistency improvements across filter endpoints.
  • Why the change was made

    • To return correct HTTP semantics (avoid ambiguous null responses) and improve API reliability for clients consuming these endpoints.
    • To document expected responses clearly in the OpenAPI spec for better consumer tooling and DX.
    • To prevent potential resource leaks by consistently closing PDDocument.

Checklist

General

Documentation

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have tested my changes locally. Refer to the Testing Guide for more details.

@Copilot Copilot AI review requested due to automatic review settings September 6, 2025 09:24
@dosubot dosubot bot added the size:L This PR changes 100-499 lines ignoring generated files. label Sep 6, 2025
Copy link
Contributor

@Copilot 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 fixes API response handling in PDF filter endpoints by implementing proper HTTP semantics. Instead of returning ambiguous null responses, the endpoints now return HTTP 204 No Content when filters fail and HTTP 200 when they pass.

  • Replaced null returns with ResponseEntity.noContent().build() for failed filter conditions
  • Added comprehensive OpenAPI documentation with @ApiResponses annotations
  • Implemented proper resource management with try-with-resources for PDDocument instances
  • Consolidated repetitive comparison logic into a reusable generic helper method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@stirlingbot stirlingbot bot added Java Pull requests that update Java code Back End Issues related to back-end development API API-related issues or pull requests Bugfix Pull requests that fix bugs labels Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API-related issues or pull requests Back End Issues related to back-end development Bugfix Pull requests that fix bugs Java Pull requests that update Java code size:L This PR changes 100-499 lines ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants