-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from urashin/base-api-impl
SpringFoxを使ってRest APIドキュメントを自動生成する仕組みを追加
- Loading branch information
Showing
3 changed files
with
44 additions
and
6 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
34 changes: 34 additions & 0 deletions
34
src/main/java/org/microvolunteer/platform/config/SwaggerConfiguration.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,34 @@ | ||
package org.microvolunteer.platform.config; | ||
|
||
import com.google.common.base.Predicate; | ||
import com.google.common.base.Predicates; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
@Configuration | ||
@EnableSwagger2 | ||
public class SwaggerConfiguration { | ||
@Bean | ||
public Docket swaggerSpringMvcPlugin() { | ||
return new Docket(DocumentationType.SWAGGER_2) | ||
.groupName("micro-volunteer-api") // APIドキュメントをグルーピングするための識別名 | ||
.select() | ||
.paths(paths()) | ||
.build() | ||
.apiInfo(apiInfo()); | ||
} | ||
|
||
private Predicate<String> paths() { | ||
return Predicates.or(Predicates.containsPattern("/v1/api*")); | ||
} | ||
|
||
private ApiInfo apiInfo() { | ||
ApiInfo apiInfo = new ApiInfo("micro-volunteer API", "micro-volunteer platformを利用するためのAPIです。", | ||
"v1", "", "http://micro-volunteer-supporter.com", "", ""); | ||
return apiInfo; | ||
} | ||
} |
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