I have a Spring Boot project with next dependency of Springfox:
io.springfox
spri
You have added the @ApiIgnore
annotation on an interface. It looks like, this annotation doesn't work when added on an interface. (I really don't understand why @Api
works on an interface and @ApiIgnore
don't.
Another option is to just remove the @Api completely, and your controller and its methods shouldn't be picked up by swagger.
One more way is to use @ApiOperation(hidden = true)
This can be used at controller/handler level method.
E.g.
@RestController
public HomeController{
@ApiOperation(value = "<Your Message>", hidden = true)
public String getMessage(@RequestParam(value = "msg") final String msg){
return msg;
}
}
The scenario where we want to hide only a particular method(s) from the class. For swagger.v3 there is an annotation with name Hidden
in io.swagger.core.v3:swagger-annotations:2.0.10 jar
. Methods to be hidden can be annotated with Hidden
annotation as shown below. The below method shows the method with DELETE
operation which needs to be hidden from the swagger documentation.
@DELETE
@Hidden
public void deleteList(int id) {
//code goes here.
}
For OpenAPI3 and SpringBoot:
I used @Hidden annotation on a method of a controller.
It seems to work both at method level and controller level.
@Hidden annotation was imported from using:
import io.swagger.v3.oas.annotations;