Springdoc OpenAPI multiple servers json

Viewed 705

I am looking into the possibility to have one central swagger UI where you can see the /v3/api-docs from multiple localhost.

My idea for this was to have multiple GroupedOpenApi Beans were each goes to a different localhost. For example:

@Bean
public GroupedOpenApi apimicroservice() {
      String service = discoveryClient.getServices().get(0);
      return GroupedOpenApi.builder().group("microservice-test").pathsToMatch(
       //Here the api-docs of the given host, example:
         "http://localhost:8080/v3/api-docs"
       //Or like how I want it with eureka:
        "http://" + service + "/v3/api-docs"
      ).build();
} 

Is this possible, maybe not with GroupedOpenApi but something else?

When I now create multiple @Bean for GroupedOpenApi it works but I would like it to be 1 bean with a List<GroupedOpenApi> but that doesn't work in my UI. Is this possible?

Thanks in advance!

1 Answers
Related