프론트 개발자와 백엔드 개발자끼리 공유하는 문서
tool
등 있음
Swagger사용방법에 대해서 설명하겠음
Swagger
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
@Configuration
@EnableSwagger2
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() {
String description = "Welcome Log Company";
return new ApiInfoBuilder()
.title("SWAGGER TEST")
.description(description)
.version("1.0")
.build();
}
@EnableSwagger2
Docket
select()
paths()
apiInfo()
해당 API에 대한 자세한 설명
@ApiOperation("선택한 날짜의 모든 일기 데이터 가져오기")
@GetMapping("/read/diary")
public List<Diary> readDiary(@RequestParam @DateTimeFormat(iso=DateTimeFormat.ISO.DATE)@ApiParam(value = "yyyy-MM-dd",example = "2020-02-02") LocalDate date){
List<Diary> diary = diaryService.getDiary(date);
return diary;
}
이외 더자세한 내용
swagger2