fix: Send request queue write fields under the names the API declares - #1026
Draft
vdusek wants to merge 8 commits into
Draft
fix: Send request queue write fields under the names the API declares#1026vdusek wants to merge 8 commits into
vdusek wants to merge 8 commits into
Conversation
`RequestDraft` declared only id/unique_key/url/method and leaned on `extra='allow'` for the rest, but `alias_generator=to_camel` never touches extras. So `user_data`, `no_retry`, `headers`, `payload`, `retry_count`, and `handled_at` reached the API snake_cased on `add_request` and `batch_add_requests`, which the API ignores silently. `update_request` was unaffected - it uses `Request`, which declares the full shape. The spec declares those request bodies as `RequestBase` and uses `RequestDraft` only for `unprocessedRequests` in responses, so the codegen postprocessor now reparents `RequestDraft` onto `RequestBase`. `RequestDraftDict.unique_key` and `.url` are no longer statically required: PEP 589 forbids a TypedDict subclass from redeclaring a key of its base. Pydantic still enforces both at runtime, before any HTTP call.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1026 +/- ##
==========================================
+ Coverage 94.95% 98.17% +3.21%
==========================================
Files 58 58
Lines 5436 5426 -10
==========================================
+ Hits 5162 5327 +165
+ Misses 274 99 -175
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
add_requestandbatch_add_requestssent request fields snake_cased. The API declares its write bodies withadditionalProperties: false, so it rejected the whole write with HTTP 400 — a request carryinguser_data,no_retry,retry_count,loaded_url,error_messages, orhandled_atcould not be added at all. The identical dict passed toupdate_requestworked:RequestDraftdeclared onlyid/unique_key/url/methodand left the rest toextra='allow', whichalias_generator=to_camelnever touches. The spec uses it only forunprocessedRequestsin responses and declares both add-request bodies asRequestBase— the client was using a response schema as its input model. The codegen postprocessor now reparentsRequestDraftontoRequestBase. Both upstream spec fixes (#952, apify-docs#2774) are closed.Three things to know:
retry_count='abc'or a naivehandled_atnow raiseValidationErrorinstead of a 400 from the API.update_request's timestamp format changes (fa77d88):mode='json'emits ISO 8601 where python mode emitted2019-06-16 10:23:31.607000+00:00. The API accepts both, so this is spec fidelity, not a fix — its own commit, revertible alone.RequestDraftDictloses the staticRequiredmarker onunique_key/url— PEP 589 forbids redeclaring a base's key. Pydantic still enforces both at runtime.Integration tests round-trip every field through both add paths against the live API; they fail on master with
InvalidRequestError.✍️ Drafted by Claude Code