Closed
Description
Describe the feature
For generating documentation using @ResponseStatus
on methods of my @ControllerAdvice
class I have overridden a method named handleMethodArgumentNotValid
of ResponseEntityExceptionHandler
I expect the response code will be generated as it does for @ExceptionHandler
methods.
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using?
2.4.2 - What modules and versions of springdoc-openapi are you using?
org.springdoc:springdoc-openapi-kotlin:1.5.9
org.springdoc:springdoc-openapi-ui:1.5.9 - What is the actual and the expected result using OpenAPI Description (yml or json)?
json - Provide with a sample code (HelloController) or Test that reproduces the problem
@ControllerAdvice
class CustomResponseEntityHandler : ResponseEntityExceptionHandler() {
@org.springframework.web.bind.annotation.ResponseStatus(HttpStatus.BAD_REQUEST)
override fun handleMethodArgumentNotValid(.....) : ResponseEntity<Any> -> **NO response code generated**
@org.springframework.web.bind.annotation.ResponseStatus(HttpStatus.REQUEST_TIMEOUT)
@ExceptionHandler(TransactionTimedOutException::class)
fun handleTransactionTimeout(....): ResponseEntity<ResponseStatus> -> **Response code generated**
Expected behavior
- A clear and concise description of what you expected to happen.
At least a response code json object 400 Bad Request generated in my api.json file as following.
"400": {
"description": "Bad Request",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResponseStatus"
}
}
}
},
If this is not the way it suppose to work, I appreciate any kind of help.
Thanks & Best Regards,
Oguzhan