Skip to content

Disable ControllerAdvice generic responses per controller endpoint method  #2934

@gnfpt

Description

@gnfpt

Currently we have springdoc.override-with-generic-response=false to disable generic responses based on ControllerAdvices.

It's also possible to use @hidden in a ControllerAdvice to hide generic responses from all controllers methods.

But, AFAIK, there's no possibility to disable generic responses on a controller endpoint method.

Something like:

@RestController
@RequestMapping("/greeting")
public class  ExampleController {

  @DisableGenericResponses
  @ReponseStastus(OK) 
  @ApiResponse(responseCode="200")
  @GetMapping
   public  String getGreeting() {
     return "Hello World";
   }

  @ReponseStastus(OK) 
  @ApiResponse(responseCode="200")
  @GetMapping
   public  String sayHi() {
     return "Hi";
   }
}

This would be helpful because it would allow to continue using generic responses based on ControllerAdvices and disable those responses on specific endpoints, as needed.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions