I'm building enhancements off a 3rd party software with my own APIs. I have the 3rd party's static .yml files for swagger, but for my own endpoints, I'm using the springdoc annotations and OpenAPI bean declarations to generate the documentation. Can I show both in the same swagger doc?
Dynamically generated doc:
@Configuration
public class SwaggerConfiguration {
@Bean
public GroupedOpenApi myOpenApi() {
String group = "My Group API";
String paths[] = { "/**" };
GroupedOpenApi api = GroupedOpenApi.builder()
.group(group)
.pathsToMatch(paths)
.packagesToScan("org.mypackage")
.addOpenApiCustomiser(openApi -> {
openApi.setInfo(
new Info()
.title(group)
.description("[Base URL: /myapi ]")
);
}).build();
return api;
}
}
Static .yml settings in application.yml:
springdoc:
swagger-ui:
urls:
- name: My Group 1
display-name: My Group 1
url: group1.yml
- name: My Group 2
display-name: My Group 2
url: group2.yml
And so by default, springdoc will show my dynamically generated API in swagger, but once I add the static settings, the static file driven swagger groups show up and the dynamic one isn't shown. Is it possible to show both?