-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic swagger documentation (when you run, it's available at loca…
…lhost:38443/cws-ui/swagger-ui/index.html)
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
cws-service/src/main/java/jpl/cws/controller/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package jpl.cws.controller; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||
import springfox.documentation.builders.ApiInfoBuilder; | ||
import springfox.documentation.builders.PathSelectors; | ||
import springfox.documentation.builders.RequestHandlerSelectors; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
import springfox.documentation.swagger.web.UiConfiguration; | ||
import springfox.documentation.swagger.web.UiConfigurationBuilder; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
@EnableSwagger2 | ||
@EnableWebMvc | ||
public class SwaggerConfig { | ||
@Bean | ||
public Docket api() { | ||
return new Docket(DocumentationType.SWAGGER_2) | ||
.select() | ||
.apis(RequestHandlerSelectors.any()) | ||
.paths(PathSelectors.any()) | ||
.build() | ||
.apiInfo(apiInfo()); | ||
} | ||
|
||
private ApiInfo apiInfo() { | ||
return new ApiInfoBuilder() | ||
.title("API") | ||
.description("API Desc") | ||
.version("V1") | ||
.build(); | ||
} | ||
|
||
@Bean | ||
public UiConfiguration uiConfiguration() { | ||
return UiConfigurationBuilder | ||
.builder() | ||
.defaultModelExpandDepth(-1) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters