You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0081aa8
Browse filesBrowse the repository at this point in the historyBrowse files
docs(openapi): Add generic 4xx errors to OpenAPI spec (#2328)
## Summary
- Add Agents directives about 4xx errors in the OpenAPI spec
- Add generic 4xx errors where suitable based on the directives.
## Motivation
- Solve OpenAPI validation errors for missing error responses
## Issues
Partially implements: #2286
Copy file name to clipboardExpand all lines: AGENTS.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,13 +55,21 @@ Add code samples by creating files in `apify-api/openapi/code_samples/{javascrip
55
55
56
56
- Prefer re-use of existing objects via `$ref` over duplication. Reusable components can be found in `/openapi/components`.
57
57
- Components most suitable for re-use are:
58
-
- Request parameters and path parameters defined in `/openapi/components/parameters`
59
-
- Request/response schemas defined in `/openapi/components/schemas`
60
-
- Explicit non-automatic examples defined in `/openapi/components/examples`
58
+
- Request parameters and path parameters defined in `/openapi/components/parameters`
59
+
- Request/response schemas defined in `/openapi/components/schemas`
60
+
- Explicit non-automatic examples defined in `/openapi/components/examples`
61
61
- When changing files in `/openapi/paths` look for opportunities to extract shared duplicate objects into re-usable components saved in `/openapi/components`.
62
62
- When adding new endpoints, check first if any existing path is similar and if yes, try to re-use same components. If by adding new paths you create new duplication, try to extract it into a new components and reference it instead.
63
63
- Prefer automatically generated examples from schema over explicit examples.
64
64
65
+
#### Error responses
66
+
- Re-use schemas for error responses defined in `/apify-api/openapi/components/responses`
67
+
- Each endpoint should have at least following error responses: 400 (Bad Request), 405 (Method Not Allowed), 429 (Too Many Requests).
68
+
- Endpoints that define `security: []` do not use any authentication.
69
+
- Each endpoint that uses authentication should have at least following error responses: 401 (Unauthorized), 403 (Forbidden).
70
+
- Each endpoint that has `runs/last` in its path or that has any ID related parameter (for example `actorId`, `buildId`, `runId`, `datasetId` and so on) should have at least one 404 (Not Found) error.
71
+
- Each endpoint that has `requestBody` should have at least following error responses: 413 (Payload Too Large), 415 (Unsupported Media Type).
72
+
65
73
### Theme system
66
74
67
75
Uses `@apify/docs-theme` package - a shared theme across all 6+ documentation repos. Don't modify theme files directly. Changes to the theme propagate via CI to all projects.
0 commit comments