How do I aggregate multiple Springwolf documents into one?

59 views Asked by At

I have a microservice architecture where one service acts as an API Gateway, using the help of Spring Cloud. I have a Swagger configuration class in the gateway service where I aggregate all of the other services’ Swaggers into one Swagger document:

@Configuration
public class SwaggerConfig {

    @Bean
    public CommandLineRunner openApiGroups(
            RouteDefinitionLocator locator,
            SwaggerUiConfigParameters swaggerUiParameters) {
        return args -> Objects.requireNonNull(locator
                        .getRouteDefinitions().collectList().block())
                .stream()
                .map(RouteDefinition::getId)
                .filter(id -> id.matches(".*-service"))
                .map(id -> id.replace("-service", ""))
                .forEach(swaggerUiParameters::addGroup);
    }
}

How do I create an aggregation of the Springwolf documentation in a likewise manner?

I have no idea where to start from. I tried something similar to the Swagger code but Springwolf does not have a class like SwaggerUIConfigParameters.

0

There are 0 answers