`@Hidden` Annotation Causes Swagger UI to Fail with "403 Forbidden" When Applied to All Controllers
shashiirk opened this issue · comments
Describe the bug
When applying the @Hidden
annotation to all controllers in a Spring Boot application, Swagger UI fails to load the API definition and returns a "403 Forbidden" error. This prevents access to the API documentation when all controllers are hidden.
To Reproduce
Steps to reproduce the behavior:
- Spring Boot version: 3.2.4
- springdoc-openapi-starter-webmvc-ui version: 1.5.10
- Add multiple controllers and apply the
@Hidden
annotation to all of them. - Now load the swagger docs page, it will say "Failed to load API definition."
Expected behavior
Swagger UI should handle the case where no endpoints are available for documentation gracefully, either by displaying a message indicating no endpoints are documented or by providing a default response.
Additional context
This issue occurs only when the @Hidden
annotation is applied to all controllers. If at least one controller is not hidden, the Swagger UI loads without any issues. This behavior is not intuitive and could be improved to handle cases where no endpoints are available for documentation.
Not reproducible.
Feel free to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem.
This ticket will be closed, but can be reopened if your provide the reproducible sample.