Skip to content

docs(openapi): Autofix OpenAPI spec validation errors - #3128

Draft
Pijukatel wants to merge 5 commits into
masterfrom
claude/zealous-fermat-esyyfx
Draft

Pijukatel wants to merge 5 commits into
masterfrom
claude/zealous-fermat-esyyfx

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Autogenerated OpenAPI fixes suggestions based on validation errors generated from running API integration tests with OpenAPI validator turned on.

This round used the API clients as the request generator: the JavaScript client's unit and integration tests ran through a request-only OpenAPI validator (apify/apify-client-js#1175), and the Python client was driven through the same validator locally. Only requests were validated.

Error log: https://github.com/apify/apify-client-js/actions/runs/40522703825 (warning annotations of the Unit tests and Integration tests jobs)

apify-core version: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95

Stop reason: No new fixes possible. Every request-side error the clients produced is either fixed here, already fixed on master by #3118 (the /v2/users/{userId}/limits and /v2/users/{userId}/usage/monthly paths), a known validator false positive, or out of scope (see below).

Detailed changes description

Error fixes

Actor build log: raw query parameter missing

  • Files: apify-api/openapi/components/objects/logs/log.yaml:86
  • Error: Request OpenAPI validation error GET /v2/actor-builds/{buildId}/log?raw=false: Unknown query parameter 'raw'
  • Root cause: The build log operation referenced only the stream and download parameters, while the run log and the generic log operations also reference raw. The API handles the build log by rewriting the request to /v2/logs/{buildId} with the original query string, so raw is accepted there, and both the JavaScript and the Python API clients send it. Verified against the live API: raw and download have the same effect on /v2/actor-builds/{buildId}/log as on /v2/logs/{buildId}.
  • Reference: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95/src/api/src/routes/actor_builds/build_log.ts#L23

Key-value store record: body restricted to a JSON object

Refactoring

None.

Unfixed errors

False positives

Space encoded as + in a query value

Upper-case Content-Encoding value

Potential API bugs

HTML record encoding check is case-sensitive

Out of scope errors

Store pricingModel value FLAT_PRICE_PER_MONTH

  • Error: Request OpenAPI validation error GET /v2/store?limit=10&pricingModel=FLAT_PRICE_PER_MONTH: must be equal to one of the allowed values: FREE, PRICE_PER_DATASET_ITEM, PAY_PER_EVENT
  • Root cause: The API still accepts the value, but it was removed from the specification on purpose because the pricing model is being deprecated. Left as it is.

Webhook created without its required fields

  • Error: Request OpenAPI validation error POST /v2/webhooks: /body/eventTypes: must have required property 'eventTypes' (also condition and requestUrl)
  • Root cause: A client unit test deliberately posts a placeholder body to a mock server. The specification and the API both require the three fields, so the specification is correct and the request is intentionally incomplete.

Issues

Partially implements: #2286

🤖 Generated with Claude Code

…oint

Error: Request OpenAPI validation error GET /v2/actor-builds/{buildId}/log?raw=false: Unknown query parameter 'raw'
Files: apify-api/openapi/components/objects/logs/log.yaml:86
Root cause: The build log operation referenced only the stream and download parameters, while the run log and the generic log operations also reference raw. The API handles the build log by rewriting the request to /v2/logs/{buildId} with the original query string, so raw is accepted there, and both the JavaScript and the Python API clients send it.
Reference: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95/src/api/src/routes/actor_builds/build_log.ts#L23

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Error: Request OpenAPI validation error PUT /v2/key-value-stores/{storeId}/records/{recordKey}: /body: must be object
Files: apify-api/openapi/components/schemas/key-value-stores/PutRecordRequest.yaml:5
Root cause: PutRecordRequest restricted the application/json body to an object, but the API stores whatever body arrives under the given content type, so a JSON array, string, or number is a valid record. The API clients send such values as JSON. The schema now accepts any JSON value, as the */* media type already does.
Reference: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95/src/api/src/routes/key_value_stores/record.ts#L99

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…le user ID

Error: Request OpenAPI validation error GET /v2/users/{userId}/limits: not found
Error: Request OpenAPI validation error GET /v2/users/{userId}/usage/monthly: not found
Files: apify-api/openapi/openapi.yaml:778, apify-api/openapi/paths/users/users@{userId}@limits.yaml:11, apify-api/openapi/paths/users/users@{userId}@Usage@monthly.yaml:15, apify-api/openapi/components/parameters/userParameters.yaml:1
Root cause: The specification defined these operations only under the literal path segment me. The API routes are /users/:username/limits and /users/:username/usage/monthly, and the handlers accept me, the token's own user ID or username, or an organization the token's user is a member of. The API clients build the URL from any ID. The paths are now templated with a shared userId parameter whose description explains the me alias and the access rule. The operation IDs are unchanged, so the documentation URLs stay the same.
Reference: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95/src/packages/consts/src/api_server_routes.ts#L9
Reference: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95/src/api/src/lib/users.ts#L99
Reference: https://github.com/apify/apify-core/tree/8440e7910c359526f013ea7b42394e386ecccc95/src/api/src/routes/users/limits.ts#L49

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@apify-service-account

apify-service-account commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Preview for this PR (commit f4aaade9) is ready at https://pr-3128.preview.docs.apify.com (see action run).

@apify-service-account

Copy link
Copy Markdown
Contributor

API behavior and specification alignment: Aligned.

Reviewed commit: f4aaade

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants