Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.matfax:akka-http-swagger-ui:swuiakht-1.0.3'
}
dependencies {
implementation("com.github.matfax:akka-http-swagger-ui:swuiakht-1.0.3")
}
<dependency>
<groupId>com.github.matfax</groupId>
<artifactId>akka-http-swagger-ui</artifactId>
<version>swuiakht-1.0.3</version>
</dependency>
libraryDependencies += "com.github.matfax" % "akka-http-swagger-ui" % "swuiakht-1.0.3"
:dependencies [[com.github.matfax/akka-http-swagger-ui "swuiakht-1.0.3"]]
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.
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.
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