Skip to content

Commit

Permalink
fix: swagger status code가 실제와 일치하지 않던 부분 수정
Browse files Browse the repository at this point in the history
fix: swagger status code가 실제와 일치하지 않던 부분 수정
  • Loading branch information
tjdwns5063 authored Feb 2, 2024
2 parents 0ae16b0 + b35b448 commit 75152ee
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/com/strcat/controller/BoardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
@Tag(name = "보드 및 컨텐츠")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "401", description = "인증 실패"),
@ApiResponse(responseCode = "406", description = "잘못된 요청"),
@ApiResponse(responseCode = "500", description = "서버 에러"),
@ApiResponse(responseCode = "406", description = "잘못된 요청", content = {
@Content(examples = {@ExampleObject("잘못된 요청")})
}),
@ApiResponse(responseCode = "500", description = "서버 에러", content = {
@Content(examples = {@ExampleObject("서버 에러")})
}),
})
@RestController
@RequestMapping("/boards")
Expand All @@ -44,6 +47,9 @@ public class BoardController {
@Operation(summary = "보드 생성", description = "생성 성공 후 board의 encryptedId를 반환합니다.")
@ApiResponse(responseCode = "200", description = "성공", content = {
@Content(examples = {@ExampleObject("Wd5lUSQnmEjnMVl043cEzZzNqqrA3Z9pBAVImYNwI14=")})})
@ApiResponse(responseCode = "401", description = "인증 실패", content = {
@Content(examples = {@ExampleObject("인증 실패")})
})
public String createBoard(@Parameter(hidden = true) @RequestHeader("Authorization") String token,
@RequestBody CreateBoardReqDto dto) {
return boardService.createBoard(dto, token);
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/strcat/controller/LoginController.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.strcat.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
Expand All @@ -13,6 +17,15 @@
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "로그인")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "406", description = "잘못된 요청", content = {
@Content(examples = {@ExampleObject("잘못된 요청")})
}),
@ApiResponse(responseCode = "500", description = "서버 에러", content = {
@Content(examples = {@ExampleObject("서버 에러")})
}),
})
@RestController
@RequestMapping("/login")
@RequiredArgsConstructor
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/strcat/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import com.strcat.service.BoardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import java.util.List;
import lombok.RequiredArgsConstructor;
Expand All @@ -13,6 +17,18 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@ApiResponses({
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "401", description = "인증 실패", content = {
@Content(examples = {@ExampleObject("인증 실패")})
}),
@ApiResponse(responseCode = "406", description = "잘못된 요청", content = {
@Content(examples = {@ExampleObject("잘못된 요청")})
}),
@ApiResponse(responseCode = "500", description = "서버 에러", content = {
@Content(examples = {@ExampleObject("서버 에러")})
}),
})
@RestController
@RequestMapping("/users")
@RequiredArgsConstructor
Expand Down

0 comments on commit 75152ee

Please sign in to comment.