Swagger Spring API
11,751
You can utilize the @ApiIgnore
annotation:
@ApiIgnore
@RequestMapping("/unauthorize")
@Controller
public class UnauthorizeResource {}
Author by
Raj
Updated on July 24, 2022Comments
-
Raj almost 2 years
I am using Spring Swagger library v1.0.2
Maven:
<dependency> <groupId>com.mangofactory</groupId> <artifactId>swagger-springmvc</artifactId> <version>1.0.2</version> </dependency>
I am able to scan my REST APIs and view it on the Swagger UI. I have even implemented OAuth and it is working great.
However, there is one feature that I need to implement. I want to hide some of the REST APIs. I need to do this at the class level as well as on the method level. I read about an 'hidden' attribute in the @Api annotation. I set it to 'true' but I can still see my class and all its method being displayed in the Swagger UI.
Example:
@Api( description="This class is not covered by Spring security.", value="/unauthorize", hidden=true) @RequestMapping("/unauthorize") @Controller public class UnauthorizeResource {}
Can someone please tell me how I can prevent the 'UnauthorizeResource' class from being displayed?
-
Raj over 8 yearsThank you so much! Accepted it as an answer.