Skip to content

Commit

Permalink
[DOCS] MemberToken 주입 데이터 Swagger에서 안보이게 수정 (#203)
Browse files Browse the repository at this point in the history
* docs: MemberToken을 Swagger에서 숨

* refactor: NonNull 어노테이션 추가
  • Loading branch information
Profile-exe authored Nov 19, 2024
1 parent 2cecb01 commit 94cc1c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import econo.buddybridge.utils.api.ApiResponse.CustomBody;
import econo.buddybridge.utils.api.ApiResponseGenerator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -50,7 +51,7 @@ public ApiResponse<CustomBody<AuthToken>> login(

@Operation(summary = "Access Token, Refresh Token 재발급", description = "Refresh Token을 이용해 Access Token과 Refresh Token을 재발급합니다.")
@PostMapping("/reissue")
public ApiResponse<CustomBody<AuthToken>> reissue(@MemberToken String token) {
public ApiResponse<CustomBody<AuthToken>> reissue(@Parameter(hidden = true) @MemberToken String token) {
AuthToken authToken = authService.reissue(token);
return ApiResponseGenerator.success(authToken, HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import econo.buddybridge.utils.api.ApiResponse.CustomBody;
import econo.buddybridge.utils.api.ApiResponseGenerator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
Expand Down Expand Up @@ -93,7 +94,7 @@ public ApiResponse<CustomBody<AuthToken>> loginWithToken(@RequestBody KakaoLogin
// refresh token 재발급
@Operation(summary = "Access Token, Refresh Token 재발급", description = "Refresh Token을 이용하여 두 토큰 모두 재발급합니다.")
@PostMapping("/reissue")
public ApiResponse<CustomBody<AuthToken>> reissue(@MemberToken String token) {
public ApiResponse<CustomBody<AuthToken>> reissue(@Parameter(hidden = true) @MemberToken String token) {
AuthToken authToken = oAuthLoginService.reissue(token);
return ApiResponseGenerator.success(authToken, HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
Expand All @@ -24,13 +25,13 @@ public ApiResponse<CustomBody<ErrorResponse>> handleBusinessException(BusinessEx

@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid( // 파라미터 유효성 검사 실패 시 발생하는 예외 처리
MethodArgumentNotValidException ex,
HttpHeaders headers,
HttpStatusCode status,
WebRequest request
@NonNull MethodArgumentNotValidException ex,
@NonNull HttpHeaders headers,
@NonNull HttpStatusCode status,
@NonNull WebRequest request
) {
// 공통 에러 코드로 처리
// 세부 검증 오류는 ErrorResponse.invalidParams에 담아서 반환
// 세부 검증 오류는 ErrorResponse#invalidParams에 담아서 반환
ErrorCode errorCode = CommonErrorCode.INVALID_INPUT_VALUE;

return ResponseEntity.status(errorCode.getHttpStatus())
Expand Down

0 comments on commit 94cc1c2

Please sign in to comment.