Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger 업데이트 (에러코드 추가 및 글자 형식 변경) #1046

Merged
merged 8 commits into from
Feb 9, 2025

Conversation

kyum-q
Copy link
Contributor

@kyum-q kyum-q commented Feb 2, 2025

⚡️ 관련 이슈

close #1030

📍주요 변경 사항

image

  • swagger 에러 케이스에 에러 코드 추가
    • 사진처럼 swagger 에러케이스 보면 에러 코드도 적절한 것으로 보이게끔 함
  • 전반적인 swagger 확인
  • swagger 메시지 형태 명사구로 변경
  • validationService.validateOrdinal(member, request); 가 무슨 역할인지 몰라서 제거했어요

🎸기타

고려해야 하는 내용을 작성해 주세요.

  • swagger 변경이니 프론트도 리뷰 요청보내요~
  • 제가 리뷰 확인하는 시간도 있으니 7일까지 여유롭게 기한 두었습니다~
    • 되는 사람들만 확인해주세요
  • 이전 pr과 conflict가 계속 날 것 같아서 이전 pr들 되고 머지하는게 좋을 것 같기도 합니다~

🍗 PR 첫 리뷰 마감 기한

02/07

@kyum-q kyum-q added refactor 요구사항이 바뀌지 않은 변경사항 BE 백엔드 labels Feb 2, 2025
@kyum-q kyum-q added this to the 7차 스프린트 💭 milestone Feb 2, 2025
@kyum-q kyum-q self-assigned this Feb 2, 2025
@kyum-q kyum-q changed the base branch from main to dev/be February 2, 2025 01:59
@Size(min = 8, max = 255, message = "비밀번호는 8~16자 사이로 입력해주세요.")
@Size(min = 8, max = 16, message = "비밀번호는 8~16자 사이로 입력해주세요.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋ

Comment on lines +56 to +64
@ErrorCase(description = "입력 없는 필드 존재", exampleMessage = "카테고리 이름이 null 입니다."),
@ErrorCase(description = "카테고리 이름 글자수 오류", exampleMessage = "카테고리 이름은 최대 15자까지 입력 가능합니다."),
@ErrorCase(description = "카테고리 순서 값 1 미만", exampleMessage = "카테고리의 순서는 1 이상이어야 합니다."),
@ErrorCase(description = "카테고리 순서 오류", exampleMessage = "순서가 잘못되었습니다."),
@ErrorCase(description = "기본 카테고리 수정 또는 삭제", errorCode = ErrorCode.DEFAULT_CATEGORY,
exampleMessage = "기본 카테고리는 수정 및 삭제할 수 없습니다."),
@ErrorCase(description = "삭제하려는 카테고리에 템플릿이 존재", errorCode = ErrorCode.CATEGORY_HAS_TEMPLATES,
exampleMessage = "템플릿이 존재하는 카테고리는 삭제할 수 없습니다."),
@ErrorCase(description = "카테고리 개수가 일치하지 않음(수정되지 않은 카테고리도 모두 보내주어야 합니다.)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

에러코드 있는 애와 없는 애의 차이가 무엇인가요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매번 에러코드를 입력하는 것이 불편할 것 같아서 default 로 errorCode를 설정하지 않은 것들은 1101 번으로 자동 설정해놨습니다~!

Copy link
Contributor

@jminkkk jminkkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

계속 느꼈지만 문서화 관리가 수월한 방법을 찾아봐야겠어요🤔 (찾아보 OAS 카카오테크 블로그, 토스 문서 라고 많이 쓰는 것 같은데 관리가 편해지는 건지는 사용은 안해봐서 잘 와닺지 않네요 흠)

같이 고민해봅시당🔥
굳 수고했어요 김켬미!!!!!

Comment on lines +25 to +26
headers = @Header(name = "Set-Cookie", description = "base64(${name}:${password}); path=\"/\"; HttpOnly; "
+ "Secure;"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

진짜 날잡고 인텔리 코드 스타일 바꿔야겠네요... 줄바꿈 아오...

@@ -26,7 +26,6 @@ public class CategoryService {
@Transactional
public CreateCategoryResponse create(Member member, CreateCategoryRequest request) {
validationService.validateDuplicatedCategory(request.name(), member);
validationService.validateOrdinal(member, request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

새로 생성할 카테고리의 순서는 기존 회원의 카테고리 중 가장 마지막 순서로 생성이 될텐데, 요청한 순서와 동일한지 검증하는 것 같아요.

근데 코드보니 무조건 마지막 순서면 요청에서 새 카테고리의 순서를 굳이 안 받아도 될 것 같네요...

@@ -20,5 +22,7 @@
String description();

String exampleMessage();

ErrorCode errorCode() default ErrorCode.INVALID_REQUEST;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기가 막혀~~~👍🏻

@jminkkk jminkkk merged commit 76ef3f4 into dev/be Feb 9, 2025
6 checks passed
@jminkkk jminkkk deleted the refactor/1030-swagger-update branch February 9, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 refactor 요구사항이 바뀌지 않은 변경사항
Projects
Status: Weekend Done
Development

Successfully merging this pull request may close these issues.

[REFACTOR] Swagger 최신화
4 participants