title: Swagger Api Documentation in Spring API Gateway
body: <p><a href="https://i.stack.imgur.com/oesiH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oesiH.png" alt="w" /></a></p>
  <p>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.</p>
  <p>Is there any way to document the API through API gateway in swagger or what is the best practice for this case.</p>
  <p>This is the routing configuration in API Gateway Spring boot</p>
  <pre><code>@Bean
      public RouteLocator gatewayRoutes(RouteLocatorBuilder builder) {
          return builder.routes()
                  .route(r -&gt; r.path(&quot;/order/**&quot;)
                          .filters(f -&gt; f.hystrix(option -&gt; option.setName(&quot;order-service&quot;).
                                  setFallbackUri(&quot;forward:/orderFallBack&quot;)))
                          .uri(&quot;lb://ORDER-SERVICE&quot;)
                          .id(&quot;order-service&quot;))
  
                  .route(r -&gt; r.path(&quot;/payment/**&quot;)
                          .filters(f -&gt; f.hystrix(option -&gt; option.setName(&quot;payment-service&quot;)
                                  .setFallbackUri(&quot;forward:/paymentFallBack&quot;)))
                          .uri(&quot;lb://PAYMENT-SERVICE&quot;)
                          .id(&quot;payment-service&quot;))
  
                  .route(r -&gt; r.path(&quot;/product/**&quot;)
                          .filters(f -&gt; f.hystrix(option -&gt; option.setName(&quot;product-service&quot;)
                                  .setFallbackUri(&quot;forward:/productFallBack&quot;)))
                          .uri(&quot;lb://PRODUCT-SERVICE&quot;)
                          .id(&quot;product-service&quot;))
                  .build();
      }
  </code></pre>
  <p>Swagger configuration in Order Microservice Project</p>
  <pre><code>@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(&quot;Fete Bird Order Microservice&quot;)
                  .version(&quot;1.0&quot;)
                  .description(&quot;API for managing Fete Bird Order Microservice.&quot;)
                  .license(&quot;Fete Bird License Version 1.0&quot;)
                  .build();
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/PczZX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PczZX.png" alt="enter image description here" /></a></p>