docs(openapi): Autofix OpenAPI spec validation errors#2706
Closed
Pijukatel wants to merge 1 commit into
Closed
Conversation
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
Contributor
|
🗑️ Preview for this PR was deleted. |
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
|
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).Issues
Partially implements: #2286
Generated by Claude Code