Having about 6 Spring Boot applications with REST APIs running with Actuator and Prometheus support.
These are running on Docker, but the actuator port is not exposed.
Although we can connect each application actuator to an Prometheus and Grafana instance.
On of the application has OpenAPI documentation with SwaggerUI. This SwaggerUI is exposed through Actuator management port.
<dependency>
<groupId>.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.5</version>
</dependency>
Now I want to make similar OpenAPI documentation for the other applications.
However having our users to deal with 6+ different URLs for accessing the various OpenAPI documentation is not a good solution.
Is there any way I can combine all the SwaggerUIs OpenAPI definitions into one single SwaggerUI something similar as I do with Actuator and Prometheus?
Otherwise I was thinking the only way is to have each application generate an openapi.json for its APIs, then "somehow" export this file to a running SwaggerUI application (running on docker).
I can generate an openapi.json for each application with the springdoc-openapi-maven-plugin
.
Having about 6 Spring Boot applications with REST APIs running with Actuator and Prometheus support.
These are running on Docker, but the actuator port is not exposed.
Although we can connect each application actuator to an Prometheus and Grafana instance.
On of the application has OpenAPI documentation with SwaggerUI. This SwaggerUI is exposed through Actuator management port.
<dependency>
<groupId>.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.5</version>
</dependency>
Now I want to make similar OpenAPI documentation for the other applications.
However having our users to deal with 6+ different URLs for accessing the various OpenAPI documentation is not a good solution.
Is there any way I can combine all the SwaggerUIs OpenAPI definitions into one single SwaggerUI something similar as I do with Actuator and Prometheus?
Otherwise I was thinking the only way is to have each application generate an openapi.json for its APIs, then "somehow" export this file to a running SwaggerUI application (running on docker).
I can generate an openapi.json for each application with the springdoc-openapi-maven-plugin
.
1 Answer
Reset to default 1What I have used previously is a wrapper/façade Swagger UI server.
It presents a dropdown to choose one of the 6 services. That fetches the v2/api-docs/management json (or v3/api-docs/management) for Actuator stuff from the nominated server and uses it as the base url in SwaggerUI. You need to make sure that the value of servers[].url
returned in api-docs json reflects the hostname of the actual server as seen by the browser. You can set this in Spring Boot with @OpenAPIDefinition(servers = {@Server(url = "https://hostname/",
The swagger page for a renamed server looks like the image below with the /v3/api-docs/management json.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744940943a4602317.html
评论列表(0条)