@Api(hidden = true) does not hide controller operations
See original GitHub issueUsing springfox-swagger2:2.8.0 and springfox-swagger-ui:2.8.0 (same issue with 2.9.0):
When I set the hidden=true
property on the @Api
annotation, the controller and all its endpoints are still appearing on swagger-ui
@RestController
@Api(tags="Accounts", hidden=true)
@RequestMapping(value="/v2/accounts")
public class AccountsController {
@ApiOperation(value = "Get account")
@GetMapping(value = "/{reference}")
public Account getAccount(@PathVariable String reference) {
....
}
}
If I specifically set the hidden property directly on the @ApiOperation
, it works correctly. But sometimes I want to hide all the endpoints of a controller. For now, I need to add a hidden=true on all the @ApiOperation
of the controller, and that can be boilerplate.
The hidden=true
property on the @Api
annotation was working on old versions of springfox, like the 2.3.0 I think, so it might be a regression.
Thanks !
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:15 (3 by maintainers)
Top Results From Across the Web
java - How to hide endpoints from Swagger documentation ...
One more way is to use @ApiOperation(hidden = true) This can be used at controller/ ...
Read more >Hiding Endpoints From Swagger Documentation in Spring Boot
The @ApiIgnore annotation allows us to hide an endpoint. Let's add this annotation for an endpoint in our controller:
Read more >Hide actions from Swagger / OpenAPI documentation in ASP ...
By adding this attribute on a controller or action and specifying IgnoreApi = true , it gets hidden from auto-generated documentation. However, ...
Read more >Using OpenAPI and Swagger UI - Quarkus
This guide explains how your Quarkus application can expose its API description through an OpenAPI ... Now you do not need to use...
Read more >springdoc-openapi v2.0.0
This is a community-based project, not maintained by the Spring Framework ... springdoc.api-docs.enabled. true. Boolean . To disable the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After digging a bit it appears that it works if I put a
@ApiIgnore
on the controller. But I don’t know it is the intented way to do it because it is a Springfox specific annotation while@Api
is a swagger annotation. Any guidance for doing this ?Thanks 😃
Seems related to #1731, which was marked as closed. I can confirm as well the same functionality expectation is failing for us, but using
@ApiIgnore
alleviates the problem. If we can automate this functionality for@Api(hidden = true)
->@ApiIgnore
, that would be extremely nice, but it’s nice to know there’s at least an alternative for now.