Skip to content

matfax/akka-http-swagger-ui

Repository files navigation

Swagger UI for Akka-HTTP

Build Status Codacy Badge

If you are using Swagger-Akka-Http, this library lets you easily add a route to Swagger UI without adding all the files to your repository.

Getting Started

  1. Add it to your dependencies using the Jitpack link above.
  2. Add the SwaggerUiRoute to your global route.
val routes: Route =
  new SwaggerDocService(system).routes ~
  new SwaggerUiRoute("api").route

That's it! Swagger UI can now be reached via the context path /api.

Customize the Index File

If you want to set a custom path to your Swagger JSON file or modify the layout of Swagger UI, you may consider to specify your own index file. Simply download Swagger UI and extract the index.html (other files are not necessary). Then, modify the index file and adjust the parameters as you prefer.

Finnaly, provide the resource path to your custom index file as follows:

new SwaggerUiRoute("api", Some("/api/index.html")).route