Skip to content

Conversation

@zorbash
Copy link
Contributor

@zorbash zorbash commented Jul 28, 2025

Currently the OpenApiSpex.Plug.SwaggerUI does not support multiple URLs and to preview more than a single spec one has to add the plug n times.

The SwaggerUI supports this already docs through the topbar plugin which is loaded in the SwaggerUIStandalonePreset preset open_api_spex uses.

This PR allows setting a paths keyword instead of a path string.

scope "/" do
  pipe_through :browser # Use the default browser stack
  get "/", MyAppWeb.PageController, :index
  get "/swaggerui", OpenApiSpex.Plug.SwaggerUI,
    paths: [
      latest: "/api/openapi",
      legacy: "/legacy_api/openapi",
      other_app: "http://localhost:4001/my_other_app/api/openapi"
    ]
end

Which renders as seen in the screenshot below:

Screenshot 2025-07-28 at 2 37 09 PM

It does not affect routers not using the new paths option.

@zorbash zorbash merged commit 9967e2f into master Jul 30, 2025
9 checks passed
@zorbash zorbash deleted the swagger-ui-multiple-paths branch July 30, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants