I have the above architecture in the project. Product, Order, Payment Microservice is a Rest API which currently has swagger integration, but now the flow is changed I can't expose the Microservice Rest API now all the REST API calls is been made from API Gateway.
Is there any way to document the API through API gateway in swagger or what is the best practice for this case.
This is the routing configuration in API Gateway Spring boot
@Bean
public RouteLocator gatewayRoutes(RouteLocatorBuilder builder) {
return builder.routes()
.route(r -> r.path("/order/**")
.filters(f -> f.hystrix(option -> option.setName("order-service").
setFallbackUri("forward:/orderFallBack")))
.uri("lb://ORDER-SERVICE")
.id("order-service"))
.route(r -> r.path("/payment/**")
.filters(f -> f.hystrix(option -> option.setName("payment-service")
.setFallbackUri("forward:/paymentFallBack")))
.uri("lb://PAYMENT-SERVICE")
.id("payment-service"))
.route(r -> r.path("/product/**")
.filters(f -> f.hystrix(option -> option.setName("product-service")
.setFallbackUri("forward:/productFallBack")))
.uri("lb://PRODUCT-SERVICE")
.id("product-service"))
.build();
}
Swagger configuration in Order Microservice Project
@Configuration
public class SwaggerConfiguration {
@Bean
public Docket orderApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
.paths(PathSelectors.any())
.build()
.apiInfo(getApiInfo());
}
//create api metadata that goes at the top of the generated page
private ApiInfo getApiInfo() {
return new ApiInfoBuilder()
.title("Fete Bird Order Microservice")
.version("1.0")
.description("API for managing Fete Bird Order Microservice.")
.license("Fete Bird License Version 1.0")
.build();
}
}