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

Ignore: πŸ”§ Swagger μ—λŸ¬ μ •μ˜ μ–΄λ…Έν…Œμ΄μ…˜ #150

Merged
merged 9 commits into from
Aug 13, 2024

Conversation

psychology50
Copy link
Member

μž‘μ—… 이유

image

κΈ°μ‘΄ μ—λŸ¬ 응닡을 μ •μ˜ν•˜κΈ° μœ„ν•΄, μ˜ˆμƒ 응닡을 직접 λ¬Έμžμ—΄λ‘œ μž‘μ„±ν•΄μ•Όλ§Œ ν•˜λŠ” λ¬Έμ œκ°€ 있음.
μ˜ˆμ™Έ 정보가 μˆ˜μ •λ  λ•Œλ§ˆλ‹€ κ°œλ°œμžκ°€ ν•΄λ‹Ή μ˜ˆμ™Έκ°€ λ¬Έμ„œμ— λͺ…μ‹œλ˜μ–΄ μžˆλŠ” 뢀뢄을 λͺ¨λ‘ μ°Ύμ•„μ„œ μˆ˜μ •ν•΄μ•Ό ν•œλ‹€λŠ” λ²ˆκ±°λ‘œμ›€κ³Ό 휴먼 μ—λŸ¬λ‘œ μΈν•œ 문제점 쑴재.


μž‘μ—… 사항

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiExceptionExplanation {
    Class<? extends BaseErrorCode> value();

    /**
     * BaseErrorCodeλ₯Ό κ΅¬ν˜„ν•œ Enum 클래슀의 μƒμˆ˜λͺ…
     */
    String constant();

    String name() default "";

    String mediaType() default "application/json";

    String summary() default "";

    String description() default "";
}

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiResponseExplanations {
    ApiExceptionExplanation[] errors() default {};
}
  • 2가지 μ–΄λ…Έν…Œμ΄μ…˜μ„ ν™œμš©ν•˜μ—¬ 문제λ₯Ό κ°œμ„ .
    • @ApiExceptionExplanation: μ—λŸ¬ 상세 μŠ€νŽ™μ„ μ •μ˜ν•¨.
    • @ApiResponseExplanations: 볡수개의 μ—λŸ¬ μŠ€νŽ™μ„ ν•˜λ‚˜λ‘œ λ¬ΆκΈ° μœ„ν•œ μ–΄λ…Έν…Œμ΄μ…˜

image
image

μœ„μ™€ 같이 μ •μ˜ν•˜λ©΄ λ˜‘κ°™μ΄ λ¬Έμ„œμ— μ •μ˜λ˜λ„λ‘ κ°œμ„ ν•¨.


리뷰어가 μ€‘μ μ μœΌλ‘œ 확인해야 ν•˜λŠ” λΆ€λΆ„

ν•œ 가지 단점은 @interface의 νŠΉμ„± 상, ν•„λ“œλ‘œ Enum ν˜Ήμ€ μΈν„°νŽ˜μ΄μŠ€ νƒ€μž…μ„ 갖지 λͺ»ν•¨. (μžλ°”μ˜ μ–΄λ…Έν…Œμ΄μ…˜μ€ 컴파일 μ‹œμ μ— νƒ€μž…μ΄ κ²°μ •λ˜μ–΄μ•Ό ν•˜κΈ° λ•Œλ¬Έ)
λ”°λΌμ„œ, νŠΉμ • μƒμˆ˜κ°’μ„ λ„˜κ²¨μ£ΌκΈ° μœ„ν•΄μ„  μ–΄μ©” 수 없이 BaseErrorCodeλ₯Ό κ΅¬ν˜„ν•œ enum 클래슀 정보와 μ‚¬μš©ν•˜λ €λŠ” ν•„λ“œλͺ…을 λ¬Έμžμ—΄λ‘œ λ„˜κ²¨μ£Όμ–΄μ•Όλ§Œ 함.

λ¬Έμžμ—΄μ— μ™„μ „νžˆ μ’…μ†λ˜λŠ” 문제λ₯Ό νšŒν”Όν•˜μ§€ λͺ» ν•œ 건 맀우 μ•„μ‰½μ§€λ§Œ, 적어도 μœ„ 방식을 μ‚¬μš©ν•˜λ©΄ κ°•μ œλ‘œ 컴파일 νƒ€μž…μ— μ‹€νŒ¨ν•˜κ²Œ λ§Œλ“€ μˆ˜λŠ” μžˆμœΌλ―€λ‘œ λ¬Έμ„œμ— μ˜ˆμ™Έ 정보가 잘λͺ» κΈ°μž…λ˜λŠ” κ²½μš°λŠ” νšŒν”Όν•  수 있음.


λ°œκ²¬ν•œ 이슈

  • μ—†μŒ

@psychology50 psychology50 added the refactoring λ¦¬νŒ©ν† λ§ μž‘μ—… label Aug 13, 2024
@psychology50 psychology50 self-assigned this Aug 13, 2024
@psychology50 psychology50 merged commit 1d6a1ca into dev Aug 13, 2024
2 checks passed
@psychology50 psychology50 deleted the fix/PW-492-swagger-exception-aop branch August 13, 2024 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring λ¦¬νŒ©ν† λ§ μž‘μ—…
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant