Swagger UI

cameleeck edited this page May 5, 2016 · 5 revisions

Description

If you are too lazy to add the swagger-ui resources manually - don't worry, we've already done that for you. Just add this module

Backend API documentation

Swagger UI resources are placed in /resources/static/swagger folder. That means that you will have it (for Spring Boot) out of the box when you access the http://yourmicroservice.com/swagger-ui.html URL.

Overriding default Swagger-UI

When using Swagger-UI you have to provide the URL to which you want to call from your front-end to retrieve the API docs. Until now (05/09/2014) the value where the docs are searched for is fixed. So either you have to provide it yourself manually or you can create a resource that will be picked up by your resource resolvers (for Spring Boot for example in /resources/static folder)

swagger/swagger-config.js

there you can provide custom config for Swagger - for example:

window.authorizations.add("key", new ApiKeyAuthorization("someHeaderKey", "someHeaderValue", "header"));

Module configuration - Old versions

If you want to use only this module just add a dependency:

repositories {
    jcenter()
}

dependencies {
    compile 'com.ofg:micro-infra-spring-swagger-ui:0.4.1'
}