I faced with some issue generating swagger documentaion in my microservices project. When I add zuul custom routings swagger documentation becames inconsistent.
Examples:
- RestController:
@RestController public class Controller { @PostMapping("/foo") public void foo() {} }
- Zuul routings:
zuul: routes: foo: path: /bar/** url: http://localhost:8080/foo
- Swagger configuration
@Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("my.package")) .build(); } }
- What I need: Swagger UI displays /bar endpoint
- What I get: Swagger UI displays /foo endpoint (and it's useless for frontend developers because they generates their components in runtime using swagger)
So, is there any solution how can I configure swagger or zuul to avoid the problem?