Skip to content

Commit

Permalink
docs: swagger error 커스텀 어노테이션으로 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
psychology50 committed Aug 22, 2024
1 parent 5494120 commit af10a0d
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.co.pennyway.api.apis.ledger.dto.SpendingCategoryDto;
import kr.co.pennyway.api.apis.ledger.dto.SpendingSearchRes;
import kr.co.pennyway.api.common.annotation.ApiExceptionExplanation;
import kr.co.pennyway.api.common.annotation.ApiResponseExplanations;
import kr.co.pennyway.api.common.query.SpendingCategoryType;
import kr.co.pennyway.api.common.security.authentication.SecurityUserDetails;
import kr.co.pennyway.domain.domains.spending.exception.SpendingErrorCode;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
Expand Down Expand Up @@ -98,14 +101,9 @@ ResponseEntity<?> getSpendingTotalCountByCategory(
})
@ApiResponses({
@ApiResponse(responseCode = "200", description = "지출 내역 조회 성공", content = @Content(mediaType = "application/json", schemaProperties = @SchemaProperty(name = "spendings", schema = @Schema(implementation = SpendingSearchRes.MonthSlice.class)))),
@ApiResponse(responseCode = "400", description = "type과 categoryId 미스 매치", content = @Content(examples =
@ExampleObject(name = "type과 categoryId가 유효하지 않은 조합", description = "type이 default면서, categoryId가 CUSTOM(0) 혹은 OTHER(12)일 수는 없다.", value = """
{
"code": "4005",
"message": "type의 정보와 categoryId의 정보가 존재할 수 없는 조합입니다."
}
"""
)))
})
@ApiResponseExplanations(errors = {
@ApiExceptionExplanation(value = SpendingErrorCode.class, constant = "INVALID_TYPE_WITH_CATEGORY_ID", name = "type과 categoryId 미스 매치", description = "type이 default면서, categoryId가 CUSTOM(0) 혹은 OTHER(12)일 수는 없다.")
})
ResponseEntity<?> getSpendingsByCategory(
@PathVariable(value = "categoryId") Long categoryId,
Expand Down

0 comments on commit af10a0d

Please sign in to comment.