Reputation: 41
I faced with some issue generating swagger documentaion in my microservices project. When I add zuul custom routings swagger documentation becames inconsistent.
Examples:
@RestController public class Controller { @PostMapping("/foo") public void foo() {} }
zuul: routes: foo: path: /bar/** url: http://localhost:8080/foo
@Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("my.package")) .build(); } }
So, is there any solution how can I configure swagger or zuul to avoid the problem?
Upvotes: 4
Views: 2426
Reputation: 13083
We had to add zuul configuration in application.yml file.
# custom configuration - used by swagger to rename endpoints in documentation
springfox:
documentation:
swagger:
v2:
path: /api/uaa/api-docs
whitelistInternal:
- method: GET
path: '/api/**/api-docs'
- method: GET
path: '/swagger-ui.html'
- method: GET
path: '/swagger-resources/**'
Please, check lines that suit you.
This is an example how it can be done https://dzone.com/articles/centralized-documentation-in-microservice-spring-b
Upvotes: 1