Is there a way i can remove the "basic-error-controller" from springfox swagger-ui?
Picture:
To hide the "Models" section, add defaultModelsExpandDepth: -1 to the Swagger UI configuration code in your index. html . Note the option name uses plural Model*s* not Model . Swagger UI also has many other configuration options that control API documentation rendering.
React + Spring Boot Microservices and Spring Swagger2 is an open source project used to generate the REST API documents for RESTful web services. It provides a user interface to access our RESTful web services via the web browser.
You can restrict the request handler selector to scan only the package of your project:
return new Docket( DocumentationType.SWAGGER_2) .select() .apis( RequestHandlerSelectors.basePackage( "your package" ) ) ...
I think, the most elegant solution is to include only @RestController
controllers into swagger, only thing to bear in mind, is to annotate all the REST controllers with that annotation:
new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) .paths(PathSelectors.any()) .build();
As BasicErrorController
is annotated with @Controller
only, swagger would avoid BasicErrorController
in definition file. Of course you can use your custom annotation instead of @RestController
to mark your REST controllers as controllers eligible by swagger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With