You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Integrate RFC 7807 ProblemDetail support for REST errors #218
While defining a custom response structure (ApiResponse) is standard, enterprise API environments benefit from standard format descriptions such as RFC 7807 (Problem Details for HTTP APIs). The application doesn't currently support standard Problem Detail structures, making it harder to integrate with standard API gateways or tools that expect standard error schemas.
Proposed Solution
Add support for RFC 7807 standard representation. In Spring Boot 3+, Spring has built-in support for ProblemDetail via the org.springframework.http.ProblemDetail class. Configure the application's GlobalExceptionHandler to optionally map exceptions to standard ProblemDetail structures. Standardize the ApiResponse schema fields to match or easily map from standard problem details (type, title, status, detail, instance).
User Stories
As an API client using automated monitoring tools, I want the API to return RFC 7807-compliant application/problem+json error responses so that my client tooling can read error semantics natively.
Acceptance Criteria
The global exception handlers support mapping business exceptions to standard ProblemDetail formats.
Enable spring.mvc.problemdetails.enabled=true in application.properties profiles.
Custom ApiResponse includes fields matching RFC 7807 attributes:
type (URI mapping to documentation)
title (Short description of exception)
detail (Specific message)
instance (Request path)
API returns application/problem+json content-type whenever the client explicitly requests it in the Accept header.
Tasks
Enable the Spring MVC property spring.mvc.problemdetails.enabled in profiles.
Update ApiResponse to match the key fields of ProblemDetail.
Refactor GlobalExceptionHandler handlers to construct and return ProblemDetail (or a subclass) when appropriate.
Assert the correct response content type in integration tests.
Activity