1

I have a spring boot application that generates 2 APIs from 2 specification files. I can generate a swagger-ui page for one of them by adding

springdoc.swagger-ui.url=/firstAPI.yaml

to application.properties. But how can I include the second API?

I tried:

springdoc.swagger-ui.urls=/firstAPI.yaml,/secondAPI.yaml

That creates a combined http://localhost:8080/v3/api-docs/ but at http://localhost:8080/v3/api-docs/ despite being able to choose between both specs in the top bar, the page says "Failed to load API definition" for both.

peer
  • 4,171
  • 8
  • 42
  • 73
  • Does this answer your question? [Springdoc with multiple api-docs](https://stackoverflow.com/questions/63675544/springdoc-with-multiple-api-docs) – flaxel Sep 01 '20 at 13:05

1 Answers1

5

You can use the property urls:

springdoc.swagger-ui.urls[0].name = first
springdoc.swagger-ui.urls[0].url = /firstAPI.yaml

springdoc.swagger-ui.urls[1].name = second
springdoc.swagger-ui.urls[1].url = /secondAPI.yaml

You can find this property in the documentation. There is also a nice FAQ for this question:

The properties springdoc.swagger-ui.urls.*, are suitable to configure external (/v3/api-docs url). For example if you want to agreagte all the endpoints of other services, inside one single application. Don’t forget that CORS needs to be enabled as well.

flaxel
  • 4,173
  • 4
  • 17
  • 30