Reputation: 11
I'm implementing OpenAPI documentation in a Spring Cloud Gateway service that routes to multiple microservices. I've configured the gateway to aggregate Swagger documentation from different services using GroupedOpenApi.
@OpenAPIDefinition
@Configuration
public class OpenAPIConfig {
@Bean
public List<GroupedOpenApi> apis() {
List<GroupedOpenApi> groups = new ArrayList<>();
gatewayProperties.getRoutes().forEach(route -> {
String name = route.getId();
GroupedOpenApi api = GroupedOpenApi.builder()
.group(name)
.pathsToMatch("/" + name + "/**")
.build();
groups.add(api);
});
return groups;
}
}
springdoc:
api-docs:
enabled: true
path: /v3/api-docs
swagger-ui:
enabled: true
config-url: /v3/api-docs/swagger-config
urls:
- name: auth-service
url: /auth-service/v3/api-docs
- name: multi-tenant-manager-service
url: /multi-tenant-manager-service/v3/api-docs
I have the Task Manager Service which is the only service user openapi.yml in resouces/static (and it renders fine in this service)
Unable to render this definition
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.x.y (for example, openapi: 3.1.0).
This question format provides clear context, shows what you've attempted, and asks a specific question that others can help answer.
I was expecting the swagger ui to render as it did in the task manager service.
Upvotes: 1
Views: 39