Skip to content

Update version to 1.5.0#35

Open
PasinduOG wants to merge 4 commits intodevfrom
feature/v1.5.0
Open

Update version to 1.5.0#35
PasinduOG wants to merge 4 commits intodevfrom
feature/v1.5.0

Conversation

@PasinduOG
Copy link
Copy Markdown
Contributor

This pull request updates the project to version 1.5.0, introducing a major new feature—dynamic exception mapping—along with documentation improvements and dependency updates. The changes also clarify and enhance the documentation for existing features and update all version references to 1.5.0.

New Feature: Dynamic Exception Registry

  • README.md, pom.xml, src/main/java/io/github/og4dev/exception/ApiExceptionRegistry.java: Introduces the ApiExceptionRegistry, allowing developers to map third-party exceptions (like SQL or security exceptions) to standard HTTP responses using a simple builder pattern. This registry is automatically integrated with the global exception handler for seamless RFC 9457 compliant error responses. [1] [2] [3] [4]

Documentation and Versioning

  • README.md, pom.xml: Updates all references to the new version 1.5.0, including Maven/Gradle install instructions, feature descriptions, and the version history section. [1] [2] [3] [4] [5] [6] [7] [8]
  • pom.xml: Updates the Spring Boot dependency from 4.0.3 to 4.0.5 and fixes the license URL to use HTTPS. [1] [2]

API and Documentation Improvements

  • src/main/java/io/github/og4dev/advice/GlobalResponseWrapper.java: Refines and expands the JavaDoc for the global response wrapper, clarifying its behaviors, supported types, and annotation usage. Updates the version annotation to 1.5.0.
  • README.md: Adds and clarifies documentation for new and existing features, including improved explanations for automatic response wrapping, security annotations, and the new exception registry. [1] [2] [3] [4]

Minor Enhancements

  • README.md: Improves formatting, removes outdated comments, and updates code block styles for better readability. [1] [2] [3]

These changes collectively deliver a more robust, flexible, and well-documented library for Spring Boot API response handling.

- Rewrote interface-level Javadoc with full usage example,
  error response format, and type parameter explanation
- Updated method-level Javadoc for getTargetException(),
  getStatus(), and getMessage() with detailed descriptions
- Added @Version, @SInCE, and cross-reference @see tags
- Bumped documented version to 1.4.0

Work in progress - not final release
feat(exception): update ApiExceptionTranslator Javadoc
…c exception mapping and pass any strings to AutoResponse annotation for showing custom messages
@PasinduOG PasinduOG self-assigned this Apr 18, 2026
@PasinduOG PasinduOG added the enhancement New feature or request label Apr 18, 2026
@PasinduOG PasinduOG requested a review from Copilot April 18, 2026 17:00
Copy link
Copy Markdown

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

Updates the library to v1.5.0 and introduces a new dynamic exception-to-HTTP mapping mechanism, alongside documentation refreshes and dependency/version bumps.

Changes:

  • Add ApiExceptionRegistry and integrate it with GlobalExceptionHandler for dynamic exception mapping.
  • Enhance @AutoResponse capabilities by allowing a custom response message and updating wrapper behavior/docs accordingly.
  • Bump project/Spring Boot versions and refresh README + Javadocs/version annotations across packages.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/main/java/io/github/og4dev/exception/ApiExceptionRegistry.java New registry for mapping exception types to HTTP statuses/messages.
src/main/java/io/github/og4dev/exception/GlobalExceptionHandler.java Uses optional registry to dynamically map otherwise-unhandled exceptions; version/Javadoc updates.
src/main/java/io/github/og4dev/config/ApiResponseAutoConfiguration.java Wires optional registry into the exception handler bean; refactors/customizes Jackson string deserializer implementation.
src/main/java/io/github/og4dev/annotation/AutoResponse.java Adds message() attribute and expands Javadoc/examples.
src/main/java/io/github/og4dev/advice/GlobalResponseWrapper.java Uses @AutoResponse.message() (method/class) for successful responses; Javadoc improvements.
src/main/java/io/github/og4dev/annotation/XssCheck.java Documentation wording adjustments (incl. a minor typo noted).
README.md Documents exception registry + updates version references and feature descriptions.
pom.xml Bumps library version to 1.5.0, updates Spring Boot version, and fixes license URL scheme.
Various package-info.java and version tags Updates @version metadata to 1.5.0 and minor doc cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
@@ -24,7 +24,7 @@
<img src="https://img.shields.io/badge/Spring%20Boot-4.0.3-brightgreen.svg" alt="Spring Boot">
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Spring Boot version badge still shows 4.0.3, but pom.xml was updated to Spring Boot 4.0.5 (pom.xml:39). Consider updating the badge to avoid confusing users about the supported/tested Spring Boot version.

Suggested change
<img src="https://img.shields.io/badge/Spring%20Boot-4.0.3-brightgreen.svg" alt="Spring Boot">
<img src="https://img.shields.io/badge/Spring%20Boot-4.0.5-brightgreen.svg" alt="Spring Boot">

Copilot uses AI. Check for mistakes.
Comment thread README.md
```

### Method 2: Automatic Wrapping (New in v1.4.0) 🎁
### Method 2: Automatic Wrapping (New in v1.5.0) 🎁
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This heading says automatic wrapping is “New in v1.5.0”, but @AutoResponse and GlobalResponseWrapper are annotated with @since 1.4.0 in code. Please align the README with the code/history (either revert this to 1.4.0, or update the @since tags and version history if the feature truly debuts in 1.5.0).

Suggested change
### Method 2: Automatic Wrapping (New in v1.5.0) 🎁
### Method 2: Automatic Wrapping (New in v1.4.0) 🎁

Copilot uses AI. Check for mistakes.
Comment thread README.md
## 🎁 Opt-in Automatic Wrapping (@AutoResponse)

Introduced in **v1.4.0**, you can eliminate boilerplate code by letting the library wrap your controller responses automatically.
Introduced in **v1.5.0**, you can eliminate boilerplate code by letting the library wrap your controller responses automatically.
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence says @AutoResponse was introduced in v1.5.0, but the annotation and wrapper both declare @since 1.4.0 in the source. Please reconcile the version in the README with the @since tags / actual release history.

Suggested change
Introduced in **v1.5.0**, you can eliminate boilerplate code by letting the library wrap your controller responses automatically.
Introduced in **v1.4.0**, you can eliminate boilerplate code by letting the library wrap your controller responses automatically.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +305 to 307
### 4. Class-Level Protection (New in v1.5.0) 🛡️

Apply annotations to the class level to automatically protect **ALL** string fields within that class!
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section calls class-level @AutoTrim/@XssCheck support “New in v1.5.0”, but both annotations are marked @since 1.3.0 in code. If class-level support was added later than the annotations themselves, consider rewording to clarify what is new in 1.5.0 (or update the @since tags/docs accordingly).

Suggested change
### 4. Class-Level Protection (New in v1.5.0) 🛡️
Apply annotations to the class level to automatically protect **ALL** string fields within that class!
### 4. Class-Level Protection for `@AutoTrim`/`@XssCheck` (Added in v1.5.0) 🛡️
Starting in v1.5.0, these annotations can also be applied at the class level to automatically protect **ALL** string fields within that class.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +412 to +421
* **@AutoResponse Annotation & GlobalResponseWrapper**
* Opt-in automatic response wrapping to eliminate boilerplate code.
* **Improved Granularity:** Fully supports both Class-level (`ElementType.TYPE`) and Method-level (`ElementType.METHOD`) placement for precision control over which endpoints are wrapped.
* Returns raw DTOs from controllers and automatically wraps them in `ApiResponse<T>`.
* Preserves HTTP status codes from `@ResponseStatus`.
* Intelligently skips `ResponseEntity`, `ApiResponse`, and `ProblemDetail` to prevent double-wrapping.
* **Intelligent String Handling:** Uses Spring's `ObjectMapper` to safely serialize raw `String` returns to JSON, avoiding `ClassCastException` with native converters.

* **Class-Level Security Annotations**
* `@AutoTrim` and `@XssCheck` can now be applied at the Class level (`ElementType.TYPE`) to automatically protect all String fields within the DTO at once.

* `@AutoTrim` and `@XssCheck` can now be applied at the Class level (`ElementType.TYPE`) to automatically protect all String fields within the DTO at once.
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the 1.5.0 release notes, @AutoResponse and “Class-Level Security Annotations” are listed as new, but @AutoResponse is marked @since 1.4.0 and @AutoTrim/@XssCheck are marked @since 1.3.0 in code. Please adjust the release notes (or update the @since tags) so the version history matches the source of truth.

Copilot uses AI. Check for mistakes.
Comment on lines 97 to 100
@Bean
public GlobalExceptionHandler apiResponseAdvisor() {
return new GlobalExceptionHandler();
public GlobalExceptionHandler apiResponseAdvisor(@Autowired(required = false) ApiExceptionRegistry registry) {
return new GlobalExceptionHandler(registry);
}
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api-response.enabled toggling likely doesn’t work as intended here: GlobalExceptionHandler is registered via this @Bean method, so the @ConditionalOnProperty annotation on GlobalExceptionHandler’s class won’t be evaluated for this bean definition. To make the property effective, move/add @ConditionalOnProperty(prefix="api-response", name="enabled", havingValue="true", matchIfMissing=true) onto this @Bean method (or the auto-config class) and rely on that condition instead.

Copilot uses AI. Check for mistakes.
* <li><b>Special tags:</b> {@code <!DOCTYPE>}, {@code }, {@code <![CDATA[]]>}</li>
* <li><b>Tags with attributes:</b> {@code <div class="test">}, {@code <img src="x">}</li>
* <li><b>Multiline tags:</b> Tags spanning multiple lines (DOTALL mode enabled)</li>
* <li><b>Multiline tags:</b> Tags spanning multiple lines (DOT ALL mode enabled)</li>
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Javadoc, “DOT ALL mode” is not the standard term for the regex flag; the usual name is “DOTALL”. This reads like a typo and could confuse readers.

Suggested change
* <li><b>Multiline tags:</b> Tags spanning multiple lines (DOT ALL mode enabled)</li>
* <li><b>Multiline tags:</b> Tags spanning multiple lines (DOTALL mode enabled)</li>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants