How to tell Swagger to show any service documentation that has /api/* on its path

Im having trouble to show all my endpoints documentation, in my configuration I have the following Docket:

    public Docket swaggerConfiguration() {
        return new Docket(DocumentationType.SWAGGER_2).select().paths(PathSelectors.ant("/api/*"))

And the problem is that with that ant pattern, I thought the documentation of ANY kind of url would be displayed at http://localhost:8080/swagger-ui.html if it’s prefixed by “/api/” which is the case for all my endpoints, but I noticed that Urls like @GetMapping("/roles/{id}") do not get documented, but urls like @GetMapping("/roles") do get documented.

Could someone please give me a hand with this config issue?


maybe it is stupid answer but have you try to set .ant() param as


Here in blog post you can find more information: