Skip to content

Make type in ProblemDetail nullable#35294

Closed
cw-dimedis wants to merge 2 commits into
spring-projects:mainfrom
cw-dimedis:problem-detail-nullable-type
Closed

Make type in ProblemDetail nullable#35294
cw-dimedis wants to merge 2 commits into
spring-projects:mainfrom
cw-dimedis:problem-detail-nullable-type

Conversation

@cw-dimedis

Copy link
Copy Markdown
Contributor

Make ProblemDetail type field nullable to improve JSON serialization

Background

According to RFC 9457 Section 3.1.1 the "type" member is optional and when not present, its value is assumed to be "about:blank". The current Spring implementation explicitly sets this default value, which results in all problem responses containing the unhelpful "type": "about:blank" field even when no specific problem type is needed.

Changes

This change makes the type field nullable in ProblemDetail:

  • Updated setType(@Nullable URI type) to accept null values
  • Updated getType() to return @Nullable URI
  • Removed the Assert.notNull() validation that prevented null types

Compatibility

This change is completely non-breaking. Existing users will not notice any difference in behavior:

  • The type field is still initialized to BLANK_TYPE ("about:blank") by default
  • Existing code that relies on the type always being present continues to work unchanged
  • JSON serialization will continue to show "type": "about:blank" for existing usage patterns

The only difference is that developers can now optionally set the type to null if they want cleaner JSON output without the default "about:blank" value.

Benefits

  1. Optional cleaner JSON output: Developers can now choose to omit the type field entirely by setting it to null
  2. RFC compliance: Aligns with the RFC 9457 specification where the type field is truly optional
  3. Zero impact on existing code: All current usage patterns continue to work exactly as before

Example

For users who want cleaner output, they can now do:

ProblemDetail problem = ProblemDetail.forStatus(400);
problem.setType(null); // Now possible - results in cleaner JSON

This change provides more flexibility while maintaining complete backward compatibility.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 6, 2025
Signed-off-by: Christoph Wagner <cwagner@dimedis.de>
Signed-off-by: Christoph <cwagner@dimedis.de>
@cw-dimedis cw-dimedis force-pushed the problem-detail-nullable-type branch from d92ca1f to 91f2c25 Compare August 6, 2025 12:45
@rstoyanchev rstoyanchev self-assigned this Aug 7, 2025
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 7, 2025
@rstoyanchev rstoyanchev added this to the 6.2.10 milestone Aug 7, 2025

@rstoyanchev rstoyanchev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the suggestion.

The @Nullable on the getter can cause issues for existing code. In 6.2.x we could avoid adding those and simply remove the Assert.notNull. It would put the burden on code setting a null value, but at least make it possible.

For 7.0 in the main branch we can accept the changes as is.

@cw-dimedis

Copy link
Copy Markdown
Contributor Author

@rstoyanchev Thanks for the feedback and the pragmatic approach for 6.2.x vs 7.0!

For 7.0, I'd suggest we could go further and remove the default BLANK_TYPE initialization entirely. The field would be null by default, giving cleaner JSON output out of the box and full RFC 9457 compliance without requiring developers to explicitly set type to null.

Is that something the team would consider? Shall I add another commit to prepare that change?

Cheers, Christoph

@rstoyanchev

Copy link
Copy Markdown
Contributor

That makes sense. Please, add the extra change.

Signed-off-by: Christoph Wagner <cwagner@dimedis.de>
rstoyanchev added a commit that referenced this pull request Aug 8, 2025
rstoyanchev pushed a commit that referenced this pull request Aug 8, 2025
See gh-35294

Signed-off-by: Christoph Wagner <cwagner@dimedis.de>
Signed-off-by: Christoph <cwagner@dimedis.de>
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 6, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 7, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 7, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 7, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 7, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 7, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 8, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 9, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 10, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 10, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
megglos added a commit to camunda/camunda that referenced this pull request Feb 10, 2026
Spring Framework 7 removed the default "about:blank" value for the
ProblemDetail type field (see spring-projects/spring-framework#35294).
This change preserves the previous behavior by introducing
CamundaProblemDetail with a wrap() method that ensures all error
responses include the "about:blank" type value.

Changes:
- Add CamundaProblemDetail.wrap() method to copy properties from
  existing ProblemDetail while ensuring type defaults to "about:blank"
- Update GlobalControllerExceptionHandler to wrap ProblemDetail
  instances returned by Spring's exception handlers
- Update test classes to use CamundaProblemDetail for expected responses

Link: spring-projects/spring-framework#35294
megglos added a commit to camunda/camunda that referenced this pull request Feb 10, 2026
Add an ArchUnit test that ensures org.springframework.http.ProblemDetail
is never instantiated directly in the codebase. Instead,
io.camunda.gateway.protocol.model.CamundaProblemDetail should be used.

Spring Framework 7 removed the default 'about:blank' value for the
'type' field in ProblemDetail (see spring-projects/spring-framework#35294).
CamundaProblemDetail restores this default to ensure backward
compatibility with API consumers expecting the RFC 9457 compliant
'about:blank' default value.

The rule allows imports and type references to ProblemDetail (e.g., for
method signatures or type checks) but forbids:
- Constructor calls
- Factory method calls (forStatus, forStatusAndDetail)

The CamundaProblemDetail class itself is exempt as it extends ProblemDetail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants