Skip to content

Commit c21426f

Browse files
committed
extract enums
1 parent bdca78a commit c21426f

File tree

3 files changed

+78
-60
lines changed

3 files changed

+78
-60
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
badRequest:
2+
type: integer
3+
description: HTTP status code for a bad request error.
4+
enum: [400]
5+
6+
unauthorized:
7+
type: integer
8+
description: HTTP status code for an authorization error.
9+
enum: [401]
10+
11+
notFound:
12+
type: integer
13+
description: HTTP status code for a not found error.
14+
enum: [404]
15+
16+
unprocessableEntity:
17+
type: integer
18+
description: HTTP status code for an unprocessable entity error.
19+
enum: [422]
20+
21+
internalServerError:
22+
type: integer
23+
description: HTTP status code for an internal server error.
24+
enum: [500]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
badRequest:
2+
type: string
3+
description: Details about the response, such as error messages.
4+
enum: [Invalid request body]
5+
6+
badUserID:
7+
type: string
8+
description: Details about the response, such as error messages.
9+
enum: [Invalid userID format]
10+
11+
unauthorized:
12+
type: string
13+
description: Details about the response, such as error messages.
14+
enum: [Unauthorized]
15+
16+
genericNotFound:
17+
type: string
18+
description: Details about the response, such as error messages.
19+
enum: [Not Found]
20+
21+
genericUnprocessableEntity:
22+
type: string
23+
description: Details about the response, such as error messages.
24+
enum: [Unprocessable Entity]
25+
26+
invalidUserID:
27+
type: string
28+
description: Details about the response, such as error messages.
29+
enum: [UserID must contain only alphanumeric, equal, plus, slash, hyphen, or underscore characters, and be between 1 and 129 characters long]
30+
31+
internalServerError:
32+
type: string
33+
description: Details about the response, such as error messages.
34+
enum: [Internal Server Error]
35+
36+

specs/advanced-personalization/common/schemas/ErrorResponses.yml

Lines changed: 18 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,54 @@ badRequest:
22
type: object
33
properties:
44
status:
5-
type: integer
6-
description: HTTP status code.
7-
enum:
8-
- 400
5+
$ref: './ErrorCodes.yml#/errorCodeBadRequest'
96
message:
10-
type: string
11-
description: Details about the response, such as error messages.
12-
enum:
13-
- Invalid request body
7+
$ref: './ErrorMessages.yml#/badRequest'
148

159
badUserID:
1610
type: object
1711
properties:
1812
status:
19-
type: integer
20-
description: HTTP status code.
21-
enum:
22-
- 400
13+
$ref: './ErrorCodes.yml#/badRequest'
2314
message:
24-
type: string
25-
description: Details about the response, such as error messages.
26-
enum:
27-
- Invalid userID format
15+
$ref: './ErrorMessages.yml#/badUserID'
2816

29-
genericNotFound:
17+
unauthorized:
3018
type: object
3119
properties:
3220
status:
33-
type: integer
34-
description: HTTP status code.
35-
enum:
36-
- 404
21+
$ref: './ErrorCodes.yml#/unauthorized'
3722
message:
38-
type: string
39-
description: Details about the response, such as error messages.
40-
enum:
41-
- Not Found
23+
$ref: './ErrorMessages.yml#/unauthorized'
4224

43-
genericUnprocessableEntity:
25+
genericNotFound:
4426
type: object
4527
properties:
4628
status:
47-
type: integer
48-
description: HTTP status code.
49-
enum:
50-
- 422
29+
$ref: './ErrorCodes.yml#/notFound'
5130
message:
52-
type: string
53-
description: Details about the response, such as error messages.
54-
enum:
55-
- Unprocessable Entity
31+
$ref: './ErrorMessages.yml#/genericNotFound'
5632

57-
internalServerError:
33+
genericUnprocessableEntity:
5834
type: object
5935
properties:
6036
status:
61-
type: integer
62-
description: HTTP status code.
63-
enum:
64-
- 500
37+
$ref: './ErrorCodes.yml#/unprocessableEntity'
6538
message:
66-
type: string
67-
description: Details about the response, such as error messages.
68-
enum:
69-
- Internal Server Error
39+
$ref: './ErrorMessages.yml#/genericUnprocessableEntity'
7040

7141
invalidUserID:
7242
type: object
7343
properties:
7444
status:
75-
type: integer
76-
description: HTTP status code.
77-
enum:
78-
- 422
45+
$ref: './ErrorCodes.yml#/unprocessableEntity'
7946
message:
80-
type: string
81-
description: Details about the response, such as error messages.
82-
enum:
83-
- UserID must contain only alphanumeric, equal, plus, slash, hyphen, or underscore characters, and be between 1 and 129 characters long
47+
$ref: './ErrorMessages.yml#/invalidUserID'
8448

85-
unauthorized:
49+
internalServerError:
8650
type: object
8751
properties:
8852
status:
89-
type: integer
90-
description: HTTP status code.
91-
enum:
92-
- 401
53+
$ref: './ErrorCodes.yml#/internalServerError'
9354
message:
94-
type: string
95-
description: Details about the response, such as error messages.
96-
enum:
97-
- Unauthorized
55+
$ref: './ErrorMessages.yml#/internalServerError'

0 commit comments

Comments
 (0)