Skip to content

Commit

Permalink
[docs] Swagger description 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwoo7 committed Aug 19, 2024
1 parent e75b719 commit 4796891
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import com.book.backend.domain.user.mapper.UserMapper;
import com.book.backend.domain.user.service.UserService;
import com.book.backend.global.ResponseTemplate;
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 jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -22,6 +26,9 @@ public class UserController {
private final ResponseTemplate responseTemplate;
private final UserMapper userMapper;

@Operation(summary = "유저 정보 불러오기", description = "유저 정보를 불러옵니다.",
responses = {@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserDto.class)),
description = UserDto.description)})
@GetMapping("/info")
public ResponseEntity<?> getUserInfo() {
log.trace("UserController > getUserInfo()");
Expand All @@ -32,6 +39,9 @@ public ResponseEntity<?> getUserInfo() {
return responseTemplate.success(userDto, HttpStatus.OK);
}

@Operation(summary = "유저 정보 수정", description = "유저의 변경 가능한 정보를 수정합니다.",
responses = {@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserInfoDto.class)),
description = UserInfoDto.description)})
@PutMapping("/info/edit")
public ResponseEntity<?> editUserInfo(@Valid @RequestBody UserInfoDto requestDto) {
log.trace("UserController > editUserInfo()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public class UserInfoDto {

@Past(message = "현재 날짜보다 이전 날짜여야 합니다.")
private LocalDate birthDate;

public static final String description =
"nickname : 닉네임 | " +
"gender : 성별 | " +
"birthDate : 생일";
}

0 comments on commit 4796891

Please sign in to comment.