-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[INIT] Swagger 설정
- Loading branch information
Showing
8 changed files
with
177 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
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
src/main/java/com/tiki/server/common/config/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 com.tiki.server.common.config; | ||
|
||
import static io.swagger.v3.oas.models.security.SecurityScheme.Type.HTTP; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import lombok.val; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public OpenAPI openApi() { | ||
val securityScheme = new SecurityScheme(); | ||
securityScheme.setType(HTTP); | ||
securityScheme.setScheme("bearer"); | ||
securityScheme.setBearerFormat("JWT"); | ||
|
||
val components = new Components(); | ||
components.addSecuritySchemes("BearerAuthentication", securityScheme); | ||
|
||
val securityRequirement = new SecurityRequirement(); | ||
securityRequirement.addList("BearerAuthentication"); | ||
|
||
val info = new Info(); | ||
info.setTitle("TIKI API Document"); | ||
info.setDescription("티키 API 명세서"); | ||
info.setVersion("1.0.0"); | ||
|
||
return new OpenAPI() | ||
.components(components) | ||
.security(List.of(securityRequirement)) | ||
.info(info); | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/com/tiki/server/external/controller/docs/S3ControllerDocs.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,40 @@ | ||
package com.tiki.server.external.controller.docs; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import com.tiki.server.common.dto.ErrorResponse; | ||
import com.tiki.server.common.dto.SuccessResponse; | ||
import com.tiki.server.external.dto.request.PreSignedUrlRequest; | ||
import com.tiki.server.external.dto.response.PreSignedUrlResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "S3", description = "AWS S3 API") | ||
public interface S3ControllerDocs { | ||
|
||
@Operation( | ||
summary = "Presigned Url 생성", | ||
description = "s3로부터 Presigned Url을 생성한다.", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "성공", | ||
content = @Content(schema = @Schema(implementation = SuccessResponse.class))), | ||
@ApiResponse( | ||
responseCode = "4xx", | ||
description = "클라이언트(요청) 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "S3 PRESIGNED URL 불러오기 실패", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} | ||
) | ||
ResponseEntity<SuccessResponse<PreSignedUrlResponse>> getPreSignedUrl( | ||
@RequestBody PreSignedUrlRequest request | ||
); | ||
} |
3 changes: 0 additions & 3 deletions
3
src/main/java/com/tiki/server/member/adapter/MemberFinder.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
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
76 changes: 76 additions & 0 deletions
76
src/main/java/com/tiki/server/timeblock/controller/docs/TimeBlockControllerDocs.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,76 @@ | ||
package com.tiki.server.timeblock.controller.docs; | ||
|
||
import java.security.Principal; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
import com.tiki.server.common.dto.ErrorResponse; | ||
import com.tiki.server.common.dto.SuccessResponse; | ||
import com.tiki.server.timeblock.dto.request.TimeBlockCreationRequest; | ||
import com.tiki.server.timeblock.dto.response.TimeBlockCreationResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.enums.ParameterIn; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "time-blocks", description = "타임 블록 API") | ||
public interface TimeBlockControllerDocs { | ||
|
||
@Operation( | ||
summary = "타임 블록 생성", | ||
description = "타임 블록을 생성한다.", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "201", | ||
description = "성공", | ||
content = @Content(schema = @Schema(implementation = SuccessResponse.class))), | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "타입 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "403", | ||
description = "접근 권한 없음", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "404", | ||
description = "팀에 존재하지 않는 회원", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "404", | ||
description = "유효하지 않은 팀", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "4xx", | ||
description = "클라이언트(요청) 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} | ||
) | ||
ResponseEntity<SuccessResponse<TimeBlockCreationResponse>> createTimeBlock( | ||
@Parameter(hidden = true) Principal principal, | ||
@Parameter( | ||
name = "teamId", | ||
description = "팀 id", | ||
in = ParameterIn.PATH, | ||
example = "1" | ||
) | ||
@PathVariable long teamId, | ||
@Parameter( | ||
name = "type", | ||
description = "타임라인 타입", | ||
in = ParameterIn.QUERY, | ||
example = "executive, member" | ||
) @RequestParam String type, | ||
@RequestBody TimeBlockCreationRequest request | ||
); | ||
} |