application/problem+json
content type is not set for ProblemDetails
#2982
Labels
bug
Something isn't working
Thank you for implementing #2963, but it seems to be it is not working yet.
Describe the bug
application/problem+json
content type should be generated for endpoints, where the content type is not explicitly overridden,but it still generates the default produces media type.
To Reproduce
Has the same setup as described in the referenced ticket, but with Springdoc 2.8.7 (or preferably 2.8.8)
Spring configuration:
(I replaced
ResponseStatus
withApiResponse
just to provide a description to the users of the API, but from the code it seems like (from commit 0cd571a), theApiResponse
annotation also required for the automatedProblemDetail
content type resolver to work)application/problem+json
.Expected behavior
Screenshots

Seems like the check for replacing the content type only checks for the configuration default content type
*/*
, instead ofthe
springdoc.default-produces-media-type
configured one.Additional context
Possible solution:
I have not tested it, but if I get this right, instead of using
MediaType.ALL_VALUE
in line:springdoc-openapi/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java
Line 451 in 0cd571a
springdoc-openapi/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java
Line 454 in 0cd571a
it should use:
springDocConfigProperties.getDefaultProducesMediaType()
.Output of `./gradlew -q :app:dependencyInsight --dependency org.springdoc`:
The text was updated successfully, but these errors were encountered: