-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Detailed Description
We use the default error-handling provided by org.zalando.problem.spring.web.advice.ProblemHandling extensively in our application.
We also wish to add a trace ID parameter to all Problem responses. To do this, I thought to add a ResponseBodyAdvice<Problem> which copies the intercepted problem to a new ProblemBuilder, adds the trace ID, and returns the rebuilt problem to be the 'actual' response body.
However, in doing so, we end up breaking ConstraintViolationProblem, which no longer includes the violations field in the response JSON, because the Jackson mixin for violations is no longer used.
But ConstraintViolationProblem does not itself expose a way to set additional parameters.
I can get around this by subclassing ConstraintViolationProblem and exposing getParameters. But in future, there may be some other problem type whose type-specific data is 'lost'.
It would be great to have some way to clone a problem and retain its original type, while also providing additional parameters. Perhaps there's a way to do this and I just haven't found it yet?
Context
Adding extra information to framework-built Problem responses.
Your Environment
org.zalando:problem:0.27.0
org.zalando:problem-spring-web:0.27.0