docs(openapi): Autofix OpenAPI spec validation errors#2707
Open
Pijukatel wants to merge 3 commits into
Open
Conversation
Contributor
|
✅ Preview for this PR (commit |
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
8efdb4d to
0cdf888
Compare
Contributor
|
Important Action required — @Pijukatel please coordinate this docs PR with the Python API client PR linked below. Because this PR modifies the OpenAPI specification, the generated models in A companion PR has been opened in
|
Error: Response OpenAPI validation error {"url":"/v2/store","method":"GET","statusCode":200,"errors":[{"message":"must be string","errorCode":"type.openapi.validation","path":"/response/data/items/{n}/userFullName"}]}
Files: apify-api/openapi/components/schemas/store/StoreListActor.yaml:24
Root cause: The store index sets userFullName to null when the Actor owner has no public profile, so the GET /v2/store response can return userFullName: null. The schema typed it as a non-nullable string. Changed to type: [string, "null"], matching the description field set in the same code path.
Reference: https://github.com/apify/apify-core/tree/db6c2e4b52c836e0bb45b2e22384c59b66024726/src/packages/actor-server/src/actors/actors_store_index.server.ts#L368
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pz7UXgVxtFoCPJXQyfqR33
fnesveda
approved these changes
Jun 30, 2026
janbuchar
approved these changes
Jun 30, 2026
Comment on lines
+24
to
+27
| type: [string, "null"] | ||
| examples: [Jane H. Doe] | ||
| description: | ||
| type: string | ||
| type: [string, "null"] |
Contributor
There was a problem hiding this comment.
It would be nice to explain when these two can be missing/null, like in the Version schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Autogenerated OpenAPI fixes suggestions based on validation errors generated from running API integration tests with OpenAPI validator turned on.
Error log: https://apify-pr-test-env-logs.s3.us-east-1.amazonaws.com/apify/apify-core/27741/api-d6d396f2cd22488c525a27934442252e8901a6b8.log
apify-core version: https://github.com/apify/apify-core/tree/db6c2e4b52c836e0bb45b2e22384c59b66024726
Stop reason: All reproducible response-validation specification errors in the log were fixed (6 unique error signatures across 3 schema files). Every remaining error in the log is either a known false positive, an intentional malformed-request test, or an internal/out-of-scope endpoint, so no further spec fixes are possible.
This PR is stacked on
fix-spec-errors-from-staging, which already carries the fixes for errors that cannot be reproduced in the PR test environment.Detailed changes description
Error fixes
Nullable
buildTagon Actor version endpointsapify-api/openapi/components/schemas/actors/Version.yaml:28Response OpenAPI validation error {"url":"/v2/actors/{actorId}","method":"GET","statusCode":200,"errors":[{"message":"must be string","errorCode":"type.openapi.validation","path":"/response/data/versions/{n}/buildTag"}]}— also raised onGET /v2/actors/{actorId}/versions(/items/{n}/buildTag),POST /v2/actors/{actorId}/versions,GET /v2/actors/{actorId}/versions/{versionNumber}andPUT /v2/actors/{actorId}/versions/{versionNumber}(/data/buildTag).buildTag: null. The request schema already allowsnull, the value round-trips unchanged through the create/get/update handlers, butVersion.yamldeclaredbuildTagas a non-nullablestring. Changed totype: [string, "null"].Reduced
GET /v2/users/meresponse from an Actor runapify-api/openapi/components/schemas/users/UserPrivateInfo.yaml:2,apify-api/openapi/components/schemas/users/Plan.yaml:2Response OpenAPI validation error {"url":"/v2/users/me","method":"GET","statusCode":200,"errors":[{"message":"must have required property 'id'","path":"/response/data/id"}, ... 'email','createdAt','profile', and every required field of plan]}/v2/users/meis accessed from an Actor run without full access, the handler deletesid,email,profile,createdAtand the fullplanobject, then re-addsplancontaining onlyavailableProxyGroups. Those properties were all markedrequiredin the spec. Removedid,email,profile,createdAtfromUserPrivateInfo.requiredand reducedPlan.requiredto onlyavailableProxyGroups(the single field guaranteed in the reduced response).Optional/nullable
descriptionanduserFullNameon store Actor listingsapify-api/openapi/components/schemas/store/StoreListActor.yaml:2(required),:24(userFullName),:26(description)Response OpenAPI validation error {"url":"/v2/store","method":"GET","statusCode":200,"errors":[{"message":"must have required property 'description'","path":"/response/data/items/{n}/description"},{"message":"must have required property 'userFullName'","path":"/response/data/items/{n}/userFullName"},{"message":"must be string","errorCode":"type.openapi.validation","path":"/response/data/items/{n}/userFullName"}]}GET /v2/store(store_get) returnsStoreListActoritems where neither field is guaranteed. In the store index both fields are set from the owner's profile and becomenullwhen the owner has no public profile, anduserFullNameis optional in theStoreActortype. The spec marked both asrequiredand typed them as non-nullablestring. RemoveduserFullNameanddescriptionfromStoreListActor.requiredand changed both totype: [string, "null"].Issues
Partially implements: #2286