Skip to content

Commit 24a78eb

Browse files
authored
docs(openapi): Align 404 to use generic error and specific example (#2422)
- Add missing, but possible errors to the `ErrorResponse.yaml` - Simplify 404s to refer to a generic error and give generic missing resource text **Motivation:** - Simplify code generation by reducing the number of error objects. - Simplify upcoming documentation of redispatch endpoints (This will allow complete reuse of the response section. Using granular 404s would not allow it due to, for example, `last run` endpoints always having `actor/run not found` errors even when referring to the default dataset, while getting the dataset directly through id will never return such 404 variant ) Follow up for: #2398 Partially implements: #2286
1 parent 50f96d1 commit 24a78eb

File tree

45 files changed

+71
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+71
-479
lines changed

apify-api/openapi/components/objects/actors/acts@{actorId}@versions@{versionNumber}@env-vars@{envVarName}put.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,7 @@ shared: &shared
4343
"403":
4444
$ref: ../../responses/Forbidden.yaml
4545
"404":
46-
description: Not found - the requested resource was not found.
47-
content:
48-
application/json:
49-
schema:
50-
oneOf:
51-
- $ref: "../../schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
52-
- $ref: "../../schemas/common/errors/ActorErrors.yaml#/ActorVersionNotFoundError"
53-
- $ref: "../../schemas/common/errors/EnvVariableErrors.yaml#/EnvironmentVariableNotFoundError"
46+
$ref: ../../responses/NotFound.yaml
5447
"405":
5548
$ref: ../../responses/MethodNotAllowed.yaml
5649
"413":

apify-api/openapi/components/objects/actors/acts@{actorId}@versions@{versionNumber}put.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ shared: &shared
3939
"403":
4040
$ref: ../../responses/Forbidden.yaml
4141
"404":
42-
description: Not found - the requested resource was not found.
43-
content:
44-
application/json:
45-
schema:
46-
$ref: "../../schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
42+
$ref: ../../responses/NotFound.yaml
4743
"405":
4844
$ref: ../../responses/MethodNotAllowed.yaml
4945
"413":
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description: The HTTP request exceeded the timeout limit
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../schemas/common/ErrorResponse.yaml
6+
example:
7+
error:
8+
type: run-timeout-exceeded
9+
message: Actor run exceeded the timeout of 300 seconds for this API endpoint

apify-api/openapi/components/schemas/common/ErrorResponse.yaml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,4 @@ required:
44
type: object
55
properties:
66
error:
7-
title: ErrorDetail
8-
type: object
9-
properties:
10-
type:
11-
title: ErrorType
12-
type: string
13-
description: Machine-processable error type identifier.
14-
enum:
15-
- actor-memory-limit-exceeded
16-
- actor-not-found
17-
- invalid-input
18-
- method-not-allowed
19-
- permission-denied
20-
- rate-limit-exceeded
21-
- record-not-found
22-
- record-not-unique
23-
- record-or-token-not-found
24-
- request-id-invalid
25-
- request-too-large
26-
- run-failed
27-
- run-timeout-exceeded
28-
- token-not-valid
29-
- unknown-build-tag
30-
- unsupported-content-encoding
31-
message:
32-
type: string
33-
description: Human-readable error message describing what went wrong.
7+
$ref: ErrorDetail.yaml

apify-api/openapi/components/schemas/common/ErrorType.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum:
66
- actor-not-found
77
- invalid-input
88
- method-not-allowed
9+
- page-not-found
910
- permission-denied
1011
- rate-limit-exceeded
1112
- record-not-found
@@ -15,6 +16,9 @@ enum:
1516
- request-too-large
1617
- run-failed
1718
- run-timeout-exceeded
19+
- schedule-actor-not-found
20+
- schedule-actor-task-not-found
1821
- token-not-valid
1922
- unknown-build-tag
2023
- unsupported-content-encoding
24+
- user-not-found
Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
ActorNotFoundErrorDetail:
2-
allOf:
3-
- $ref: ../ErrorDetail.yaml
4-
- type: object
5-
properties:
6-
type:
7-
const: actor-not-found
8-
9-
RecordNotFoundErrorDetail:
10-
allOf:
11-
- $ref: ../ErrorDetail.yaml
12-
- type: object
13-
properties:
14-
type:
15-
const: record-not-found
16-
17-
RecordOrTokenNotFoundErrorDetail:
18-
allOf:
19-
- $ref: ../ErrorDetail.yaml
20-
- type: object
21-
properties:
22-
type:
23-
const: record-or-token-not-found
24-
251
RunFailedErrorDetail:
262
allOf:
273
- $ref: ../ErrorDetail.yaml
@@ -38,46 +14,6 @@ RunTimeoutExceededErrorDetail:
3814
type:
3915
const: run-timeout-exceeded
4016

41-
ActorNotFoundError:
42-
type: object
43-
properties:
44-
error:
45-
$ref: "#/ActorNotFoundErrorDetail"
46-
example:
47-
error:
48-
type: actor-not-found
49-
message: Actor was not found
50-
51-
ActorBuildNotFoundError:
52-
type: object
53-
properties:
54-
error:
55-
$ref: "#/RecordNotFoundErrorDetail"
56-
example:
57-
error:
58-
type: record-not-found
59-
message: Actor build was not found
60-
61-
RecordOrTokenNotFoundError:
62-
type: object
63-
properties:
64-
error:
65-
$ref: "#/RecordOrTokenNotFoundErrorDetail"
66-
example:
67-
error:
68-
type: record-or-token-not-found
69-
message: Actor was not found or access denied
70-
71-
ActorRunNotFoundError:
72-
type: object
73-
properties:
74-
error:
75-
$ref: "#/RecordNotFoundErrorDetail"
76-
example:
77-
error:
78-
type: record-not-found
79-
message: Actor run was not found
80-
8117
ActorRunTimeoutExceededError:
8218
type: object
8319
properties:
@@ -97,13 +33,3 @@ ActorRunFailedError:
9733
error:
9834
type: run-failed
9935
message: "Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)"
100-
101-
ActorVersionNotFoundError:
102-
type: object
103-
properties:
104-
error:
105-
$ref: "#/RecordNotFoundErrorDetail"
106-
example:
107-
error:
108-
type: record-not-found
109-
message: Actor version was not found

apify-api/openapi/components/schemas/common/errors/EnvVariableErrors.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

apify-api/openapi/components/schemas/common/errors/StorageErrors.yaml

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,6 @@ RequestIdInvalidErrorDetail:
66
type:
77
const: request-id-invalid
88

9-
DatasetNotFoundError:
10-
type: object
11-
properties:
12-
error:
13-
$ref: "./ActorErrors.yaml#/RecordNotFoundErrorDetail"
14-
example:
15-
error:
16-
type: record-not-found
17-
message: Dataset was not found
18-
19-
KeyValueStoreNotFoundError:
20-
type: object
21-
properties:
22-
error:
23-
$ref: "./ActorErrors.yaml#/RecordNotFoundErrorDetail"
24-
example:
25-
error:
26-
type: record-not-found
27-
message: Key-value Store was not found
28-
29-
RequestQueueNotFoundError:
30-
type: object
31-
properties:
32-
error:
33-
$ref: "./ActorErrors.yaml#/RecordNotFoundErrorDetail"
34-
example:
35-
error:
36-
type: record-not-found
37-
message: Request Queue was not found
38-
39-
RecordNotFoundError:
40-
type: object
41-
properties:
42-
error:
43-
$ref: "./ActorErrors.yaml#/RecordNotFoundErrorDetail"
44-
example:
45-
error:
46-
type: record-not-found
47-
message: Record was not found
48-
49-
RequestNotFoundError:
50-
type: object
51-
properties:
52-
error:
53-
$ref: "./ActorErrors.yaml#/RecordNotFoundErrorDetail"
54-
example:
55-
error:
56-
type: record-not-found
57-
message: Request was not found
58-
599
RequestIdInvalidError:
6010
type: object
6111
properties:

apify-api/openapi/paths/actor-builds/actor-builds@{buildId}.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ get:
3333
"403":
3434
$ref: ../../components/responses/Forbidden.yaml
3535
"404":
36-
description: Not found - the requested resource was not found.
37-
content:
38-
application/json:
39-
schema:
40-
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
36+
$ref: ../../components/responses/NotFound.yaml
4137
"405":
4238
$ref: ../../components/responses/MethodNotAllowed.yaml
4339
"429":
@@ -76,13 +72,7 @@ delete:
7672
"403":
7773
$ref: ../../components/responses/Forbidden.yaml
7874
"404":
79-
description: Not found - the requested resource was not found.
80-
content:
81-
application/json:
82-
schema:
83-
oneOf:
84-
- $ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
85-
- $ref: "../../components/schemas/common/errors/ActorErrors.yaml#/RecordOrTokenNotFoundError"
75+
$ref: ../../components/responses/NotFound.yaml
8676
"405":
8777
$ref: ../../components/responses/MethodNotAllowed.yaml
8878
"429":

apify-api/openapi/paths/actor-builds/actor-builds@{buildId}@abort.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ post:
2727
"403":
2828
$ref: ../../components/responses/Forbidden.yaml
2929
"404":
30-
description: Not found - the requested resource was not found.
31-
content:
32-
application/json:
33-
schema:
34-
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
30+
$ref: ../../components/responses/NotFound.yaml
3531
"405":
3632
$ref: ../../components/responses/MethodNotAllowed.yaml
3733
"429":

0 commit comments

Comments
 (0)