From 8efdb4d8a7e9561264533e97f1cefa2495dab644 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 30 Jun 2026 12:43:27 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01Pz7UXgVxtFoCPJXQyfqR33 --- .../components/schemas/actors/Version.yaml | 4 ++-- .../components/schemas/users/Plan.yaml | 21 +++---------------- .../schemas/users/UserPrivateInfo.yaml | 7 +++---- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/apify-api/openapi/components/schemas/actors/Version.yaml b/apify-api/openapi/components/schemas/actors/Version.yaml index 60854403e7..ded5169247 100644 --- a/apify-api/openapi/components/schemas/actors/Version.yaml +++ b/apify-api/openapi/components/schemas/actors/Version.yaml @@ -26,9 +26,9 @@ properties: examples: [false] description: Whether to inject the environment variables at build time. buildTag: - type: string + type: [string, "null"] examples: [latest] - description: The tag name to apply to a successful build of this version. + description: The tag name to apply to a successful build of this version. Can be `null` when the version has no build tag. sourceFiles: $ref: ./VersionSourceFiles.yaml description: Applies when the `sourceType` is `SOURCE_FILES`. Represents the Actor's diff --git a/apify-api/openapi/components/schemas/users/Plan.yaml b/apify-api/openapi/components/schemas/users/Plan.yaml index 0e3c9bd4cb..1f9e9d1333 100644 --- a/apify-api/openapi/components/schemas/users/Plan.yaml +++ b/apify-api/openapi/components/schemas/users/Plan.yaml @@ -1,24 +1,9 @@ title: Plan +# When /users/me is accessed from an Actor run, the plan object is reduced to only +# availableProxyGroups (see apify-core src/api/src/routes/users/user.ts). The other +# fields are therefore only present in the full response and cannot be always required. required: - - id - - description - - isEnabled - - monthlyBasePriceUsd - - monthlyUsageCreditsUsd - - enabledPlatformFeatures - - maxMonthlyUsageUsd - - maxActorMemoryGbytes - - maxMonthlyActorComputeUnits - - maxMonthlyResidentialProxyGbytes - - maxMonthlyProxySerps - - maxMonthlyExternalDataTransferGbytes - - maxActorCount - - maxActorTaskCount - - dataRetentionDays - availableProxyGroups - - teamAccountSeatCount - - supportLevel - - availableAddOns type: object properties: id: diff --git a/apify-api/openapi/components/schemas/users/UserPrivateInfo.yaml b/apify-api/openapi/components/schemas/users/UserPrivateInfo.yaml index f0ca851990..ceca50eff3 100644 --- a/apify-api/openapi/components/schemas/users/UserPrivateInfo.yaml +++ b/apify-api/openapi/components/schemas/users/UserPrivateInfo.yaml @@ -1,13 +1,12 @@ title: UserPrivateInfo +# The id, email, profile and createdAt fields are omitted when this endpoint is accessed +# from an Actor run, so they cannot be marked as always required (see apify-core +# src/api/src/routes/users/user.ts REMOVE_FIELDS_WHEN_ACCESSED_BY_ACTOR_RUN). required: - - id - username - - profile - - email - proxy - plan - effectivePlatformFeatures - - createdAt - isPaying type: object properties: