Skip to content

Commit

Permalink
♻️ 예외 응답 개선 (#16)
Browse files Browse the repository at this point in the history
* ♻️ 예외 응답 개선

* 🩹 validation 에러 수정
  • Loading branch information
waterfogSW authored Oct 3, 2024
1 parent 88f3df7 commit 4982296
Showing 1 changed file with 99 additions and 24 deletions.
123 changes: 99 additions & 24 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ paths:
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'

/auth/codes/{authCodeId}/newUser:
post:
Expand Down Expand Up @@ -95,6 +97,8 @@ paths:
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'


/users:
Expand Down Expand Up @@ -127,7 +131,9 @@ paths:
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
$ref: '#/components/responses/RegisterTokenExpired'
'500':
$ref: '#/components/responses/InternalServerError'

/auth/token/refresh:
post:
Expand All @@ -149,8 +155,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/RefreshTokenResponse'
'400':
$ref: '#/components/responses/InvalidRefreshToken'
'401':
$ref: '#/components/responses/Unauthorized'
$ref: '#/components/responses/RefreshTokenExpired'
'500':
$ref: '#/components/responses/InternalServerError'

/locations:
get:
Expand All @@ -166,6 +176,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/GetLocationsResponse'
'500':
$ref: '#/components/responses/InternalServerError'

/companies:
get:
Expand All @@ -185,6 +197,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/SearchCompaniesResponse'
'500':
$ref: '#/components/responses/InternalServerError'

/companies/{companyId}:
get:
Expand All @@ -204,6 +218,8 @@ paths:
$ref: '#/components/schemas/GetCompanyDetailsResponse'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'

/jobs:
get:
Expand All @@ -223,6 +239,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/SearchJobsResponse'
'500':
$ref: '#/components/responses/InternalServerError'

components:
securitySchemes:
Expand Down Expand Up @@ -304,51 +322,108 @@ components:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'

Unauthorized:
description: 인증 실패
examples:
invalidRequest:
value:
time: "2024-05-01T00:00:00Z"
type: "COMMON"
code: "1001"
message: "잘못된 요청입니다."

RegisterTokenExpired:
description: 회원 가입 토큰 만료
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
tokenExpired:
value:
time: "2024-05-01T00:00:00Z"
type: "AUTH"
code: "1003"
message: "회원 가입 토큰이 만료되었습니다."

NotFound:
description: 리소스를 찾을 수 없음
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
notFound:
value:
time: "2024-05-01T00:00:00Z"
type: "COMMON"
code: "1002"
message: "리소스를 찾을 수 없습니다."

InternalServerError:
description: 서버 오류
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
serverError:
value:
time: "2024-05-01T00:00:00Z"
type: "COMMON"
code: "1003"
message: "서버 오류가 발생했습니다."

RefreshTokenExpired:
description: 리프레시 토큰 만료
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
tokenExpired:
value:
time: "2024-05-01T00:00:00Z"
type: "AUTH"
code: "1008"
message: "리프레시 토큰이 만료되었습니다."

InvalidRefreshToken:
description: 유효하지 않은 리프레시 토큰
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalidToken:
value:
time: "2024-05-01T00:00:00Z"
type: "AUTH"
code: "1009"
message: "유효하지 않은 리프레시 토큰입니다."

schemas:
ErrorResponse:
type: object
properties:
timestamp:
type: integer
format: int64
description: 에러 발생 시각 (Unix timestamp)
status:
type: integer
description: HTTP 상태 코드
error:
time:
type: string
format: date-time
description: 에러 발생 시각 (ISO 8601)
example: "2024-05-01T00:00:00Z"
type:
type: string
description: 에러 유형
example: USER
exception:
example: COMMON
code:
type: string
description: 예외 클래스 이름
description: 에러 코드
example: "1001"
message:
type: string
description: 상세 에러 메시지
path:
type: string
description: 에러가 발생한 요청 경로
required:
- timestamp
- status
- error
- message
- path
- time
- type
- code

SendAuthCodeRequest:
type: object
Expand Down

0 comments on commit 4982296

Please sign in to comment.