Skip to content

Commit efbef1c

Browse files
Pijukatelclaude
andauthored
docs(openapi): Autofix OpenAPI spec validation errors (#3241)
## Summary Autogenerated OpenAPI fixes suggestions based on validation errors generated from running API integration tests with OpenAPI validator turned on. **apify-core version:** https://github.com/apify/apify-core/tree/2c7172719c69ddb5be59ecb418108445db5d8b1b ## Detailed changes description ### Error fixes #### Users endpoints: response for proxy password callers - **Files:** `apify-api/openapi/paths/users/users@{userId}.yaml:35`, `apify-api/openapi/paths/users/users@me.yaml:21`, `apify-api/openapi/components/schemas/users/UserProxyInfo.yaml:1`, `apify-api/openapi/components/schemas/users/UserProxyInfoResponse.yaml:1` - **Error:** `GET /v2/users/{userId} 200: /response/data/username must have required property 'username'; /response must match a schema in anyOf` (453×) and `GET /v2/users/me 200: /response/data/username must have required property 'username'` (126×) - **Root cause:** This is the error that grew the log. Since apify-core#32760 (merged 2026-11-16, the same day the log starts), a request authenticated with a proxy password (`PROXY_PASSWORD` or `ACTOR_RUN_PROXY_PASSWORD`) gets only `plan.availableProxyGroups`, `effectivePlatformFeatures` and `isPaying`. Apify Proxy reads the user plan this way. The spec allowed only the public and private user objects, and both require `username`. This PR adds a `UserProxyInfoResponse` variant to both endpoints. `/v2/users/me` changes from a single `$ref` to an `anyOf`, so generated clients get a union type for this endpoint, the same as `/v2/users/{userId}` already has. - **Reference:** https://github.com/apify/apify-core/tree/2c7172719c69ddb5be59ecb418108445db5d8b1b/src/console/backend/src/lib/services/user/user.service.ts#L1499, test: https://github.com/apify/apify-core/tree/2c7172719c69ddb5be59ecb418108445db5d8b1b/tests/integration/tests/other/users.js#L74 #### Schedules: `uiState` can be `null` - **Files:** `apify-api/openapi/components/schemas/schedules/ScheduleUiState.yaml:2` - **Error:** `GET /v2/schedules/{scheduleId} 200` (4×) and `PUT /v2/schedules/{scheduleId} 200` (2×): `/response/data/uiState must be object` - **Root cause:** When an API update changes `cronExpression` or `timezone`, the service sets `uiState` to `undefined` in the Mongo `$set`. The MongoDB driver stores `undefined` as `null` because `ignoreUndefined` is off, so later GET and PUT responses return `uiState: null`. - **Reference:** https://github.com/apify/apify-core/tree/2c7172719c69ddb5be59ecb418108445db5d8b1b/src/console/backend/src/lib/services/schedules.service.ts#L382 ## Issues Partially implements: #2286 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d2be41b commit efbef1c

5 files changed

Lines changed: 34 additions & 3 deletions

File tree

‎apify-api/openapi/components/schemas/schedules/ScheduleUiState.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
title: ScheduleUiState
2-
type: object
2+
type: [object, "null"]
33
description: >-
44
State of the schedule editor in Apify Console. It's removed when an API update changes
5-
`cronExpression` or `timezone`.
5+
`cronExpression` or `timezone`, after which it is `null`.
66
properties:
77
version:
88
type: integer
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
title: UserProxyInfo
2+
description: Reduced user data with only the fields Apify Proxy reads.
3+
required:
4+
- plan
5+
- effectivePlatformFeatures
6+
- isPaying
7+
type: object
8+
properties:
9+
plan:
10+
title: UserProxyPlan
11+
required:
12+
- availableProxyGroups
13+
type: object
14+
properties:
15+
availableProxyGroups:
16+
$ref: ./AvailableProxyGroups.yaml
17+
effectivePlatformFeatures:
18+
$ref: ./EffectivePlatformFeatures.yaml
19+
isPaying:
20+
type: boolean
21+
examples: [true]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
title: UserProxyInfoResponse
2+
required:
3+
- data
4+
type: object
5+
properties:
6+
data:
7+
$ref: ./UserProxyInfo.yaml

‎apify-api/openapi/paths/users/users@me.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ get:
1818
content:
1919
application/json:
2020
schema:
21-
$ref: ../../components/schemas/users/UserPrivateInfoResponse.yaml
21+
anyOf:
22+
- $ref: ../../components/schemas/users/UserPrivateInfoResponse.yaml
23+
- $ref: ../../components/schemas/users/UserProxyInfoResponse.yaml
2224
"400":
2325
$ref: ../../components/responses/BadRequest.yaml
2426
"401":

‎apify-api/openapi/paths/users/users@{userId}.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ get:
3232
anyOf:
3333
- $ref: ../../components/schemas/users/UserPublicInfoResponse.yaml
3434
- $ref: ../../components/schemas/users/UserPrivateInfoResponse.yaml
35+
- $ref: ../../components/schemas/users/UserProxyInfoResponse.yaml
3536
"400":
3637
$ref: ../../components/responses/BadRequest.yaml
3738
"401":

0 commit comments

Comments
 (0)