PhoenixSwagger.Plug.SwaggerUI (phoenix_swagger v0.8.3) View Source

Swagger UI in a plug.


Generate a swagger file and place it in your applications priv/static dir:

mix phoenix.swagger.generate priv/static/myapp.json

Add a swagger scope to your router, and forward all requests to SwaggerUI

scope "myapp/api/swagger" do
  forward "/", PhoenixSwagger.Plug.SwaggerUI, otp_app: :myapp, swagger_file: "myapp.json"

Run the server with mix phoenix.server and browse to localhost:8080/myapp/api/swagger/, swagger-ui should be shown with your swagger spec loaded.

Link to this section Summary

Functions callback

Plug.init callback

Link to this section Functions callback

Plug.init callback


  • otp_app (required) The name of the app has is hosting the swagger file
  • swagger_file (required) The name of the file, eg "swagger.json"
  • config_object (optional) These values are injected into the config object passed to SwaggerUI.
  • config_url (optional) Populates the configUrl Swagger UI parameter. A URL to fetch an external configuration document from.