Skip to content

Commit 8efdb4d

Browse files
committed
fix(openapi): allow null buildTag and reduced /users/me response
Error: Response OpenAPI validation error {"url":"/v2/actors/{actorId}","method":"GET","statusCode":200,"errors":[{"message":"must be string","path":"/response/data/versions/{n}/buildTag"}]} (also GET/POST/PUT .../versions and GET .../versions/{versionNumber}); and {"url":"/v2/users/me","method":"GET","statusCode":200,"errors":[{"message":"must have required property 'id'|'email'|'createdAt'|'profile'|plan.*"}]} Files: apify-api/openapi/components/schemas/actors/Version.yaml:28; apify-api/openapi/components/schemas/users/UserPrivateInfo.yaml:2; apify-api/openapi/components/schemas/users/Plan.yaml:2 Root cause: (1) Actor version endpoints return buildTag:null for versions created without a tag, but Version.yaml declared buildTag as a non-nullable string. (2) When /v2/users/me is accessed from an Actor run, the handler removes id, email, profile, createdAt and the full plan object, then re-adds plan containing only availableProxyGroups; the spec marked all of those as required. Reference: https://github.com/apify/apify-core/tree/db6c2e4b52c836e0bb45b2e22384c59b66024726/tests/integration/tests/actor/actors.openapi_response_validation.js#L44 ; https://github.com/apify/apify-core/tree/db6c2e4b52c836e0bb45b2e22384c59b66024726/src/api/src/routes/users/user.ts#L43 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pz7UXgVxtFoCPJXQyfqR33
1 parent b0b8f31 commit 8efdb4d

3 files changed

Lines changed: 8 additions & 24 deletions

File tree

apify-api/openapi/components/schemas/actors/Version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ properties:
2626
examples: [false]
2727
description: Whether to inject the environment variables at build time.
2828
buildTag:
29-
type: string
29+
type: [string, "null"]
3030
examples: [latest]
31-
description: The tag name to apply to a successful build of this version.
31+
description: The tag name to apply to a successful build of this version. Can be `null` when the version has no build tag.
3232
sourceFiles:
3333
$ref: ./VersionSourceFiles.yaml
3434
description: Applies when the `sourceType` is `SOURCE_FILES`. Represents the Actor's

apify-api/openapi/components/schemas/users/Plan.yaml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
title: Plan
2+
# When /users/me is accessed from an Actor run, the plan object is reduced to only
3+
# availableProxyGroups (see apify-core src/api/src/routes/users/user.ts). The other
4+
# fields are therefore only present in the full response and cannot be always required.
25
required:
3-
- id
4-
- description
5-
- isEnabled
6-
- monthlyBasePriceUsd
7-
- monthlyUsageCreditsUsd
8-
- enabledPlatformFeatures
9-
- maxMonthlyUsageUsd
10-
- maxActorMemoryGbytes
11-
- maxMonthlyActorComputeUnits
12-
- maxMonthlyResidentialProxyGbytes
13-
- maxMonthlyProxySerps
14-
- maxMonthlyExternalDataTransferGbytes
15-
- maxActorCount
16-
- maxActorTaskCount
17-
- dataRetentionDays
186
- availableProxyGroups
19-
- teamAccountSeatCount
20-
- supportLevel
21-
- availableAddOns
227
type: object
238
properties:
249
id:

apify-api/openapi/components/schemas/users/UserPrivateInfo.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
title: UserPrivateInfo
2+
# The id, email, profile and createdAt fields are omitted when this endpoint is accessed
3+
# from an Actor run, so they cannot be marked as always required (see apify-core
4+
# src/api/src/routes/users/user.ts REMOVE_FIELDS_WHEN_ACCESSED_BY_ACTOR_RUN).
25
required:
3-
- id
46
- username
5-
- profile
6-
- email
77
- proxy
88
- plan
99
- effectivePlatformFeatures
10-
- createdAt
1110
- isPaying
1211
type: object
1312
properties:

0 commit comments

Comments
 (0)