From 8f7a78ae74aa338796fcf703c9e0dc23f1d4e747 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 7 Sep 2026 08:24:55 +0000 Subject: [PATCH] fix(openapi): allow null categories in store search response Error: SOFT_FAIL {"errors":[{"errorCode":"type.openapi.validation","message":"must be array","path":"/response/data/items//categories"}],"method":"GET","msg":"Response OpenAPI validation error","statusCode":200.0,"url":"/v2/store?limit=1000&offset=&sortBy=lastUpdate"} Files: apify-api/openapi/components/schemas/store/StoreListActor.yaml:29 Root cause: `categories` is nullable in stored Actor documents, and `GET /v2/store` returns it unchanged. The write API explicitly accepts `null` for the field - both `CreateActorRequest.categories` and `UpdateActorRequest.categories` are already documented as `type: [array, "null"]` - and `updateActor` persists the modifier with a plain `$set`, so a submitted `null` is stored verbatim (the `Act2Schema` `type: Array` check does not reject it, because simpl-schema skips type checks for null values on optional keys). The Algolia consolidation daemon copies the field with `_.pick(actor, ACTOR_INDEX_FIELDS)`, preserving the `null`, and the store search route returns the hit unchanged via `toPublicSearchItem`'s spread. Every other consumer normalizes the field defensively (`actor.categories ?? []` in the Recombee sync, `$ifNull: ['$categories', []]` in the console search service, whose comment records that the stored data is not clean), but the public API route does not, so the raw `null` reaches the response and fails the `type: array` assertion. Widening the response schema to `[array, "null"]` documents the values the endpoint actually returns; it still rejects any other non-array type, so the assertion is not weakened beyond null. Reference: https://github.com/apify/apify-core/tree/912cf52953c2b5ef841ebdfbacce20a0bf0b5cfe/src/api/src/routes/store/search.ts#L179 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TWepzDer9U43JgyXjACWYv --- apify-api/openapi/components/schemas/store/StoreListActor.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apify-api/openapi/components/schemas/store/StoreListActor.yaml b/apify-api/openapi/components/schemas/store/StoreListActor.yaml index c605346f64..d7d6772d4a 100644 --- a/apify-api/openapi/components/schemas/store/StoreListActor.yaml +++ b/apify-api/openapi/components/schemas/store/StoreListActor.yaml @@ -26,9 +26,10 @@ properties: type: [string, "null"] examples: [My public actor!] categories: - type: array + type: [array, "null"] items: type: string + description: A list of categories that best define the Actor. Reflected in Apify Store's search and filtering options. Can be `null` for Actors that have no categories stored. example: - MARKETING - LEAD_GENERATION