Skip to content

When using RestControllerAdvice, one of the responses is missing and replaced with a default #440

Closed
@edgeofoblivion

Description

@edgeofoblivion

Describe the bug
Empty default response is displayed instead of one described in exception handler.

implementation 'org.springdoc:springdoc-openapi-ui:1.2.30'

To Reproduce
demo.zip
See the attached spring boot example with a single controller and a RestControllerAdvice having 2 exception handling methods.
One of the methods from the RestControllerAdvice is displayed with MediaType all and the "default response" description.

Expected behavior
Each of the handled responses displayed as described in the annotations in the Advice along with that from the GreetingController

Screenshots
ControllerAdvice

Additional context
I also believe that one of those responses described in the controller advice will be replaced with the default (not always the same method). This can be seen when restarting the application and is particularly noticeable when many handler methods exist in the same class.
See screenshot following a restart - this time the 400 is incorrect and the 500 is as expected
ControllerAdvice2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions