Swagger UI with Multiple Urls

The urls configuration option is supported in Swagger UI 3.0.18 and later.

You can use it instead of url like this:

window.onload = function() {
  // Build a system
  const ui = SwaggerUIBundle({
    urls: [
      {url: "https://path/to/api1.yaml", name: "API One"},
      {url: "https://path/to/api2.yaml", name: "API Two"},
    ],
    "urls.primaryName": "API Two"  // default document (if other than the first)
    ...
  })

Result:

"Select a definition" dropdown in Swagger UI

Leave a Comment