Skip to content

fix(openapi): Preserve RequestWithoutId and its required fields when bundling - #2774

Merged
vdusek merged 1 commit into
masterfrom
fix/request-without-id-bundling
Aug 24, 2026
Merged

fix(openapi): Preserve RequestWithoutId and its required fields when bundling#2774
vdusek merged 1 commit into
masterfrom
fix/request-without-id-bundling

Conversation

@vdusek

@vdusek vdusek commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

RequestWithoutId was a bare $ref with sibling keys, so the bundler inlined it: the published openapi.json has no such component, the add-request / batch-add-requests / update-request bodies point straight at RequestBase, and required: [uniqueKey, url] disappears. Generated clients therefore get no schema for those bodies — apify-client-python fell back to a response shape and sent userData and friends snake_cased, which the API rejects with HTTP 400 (apify/apify-client-python#1026).

Wrapping RequestWithoutId in a single-member allOf keeps it a named component through bundling. required: [uniqueKey, url] moves to RequestBase, and Request drops the now-redundant entries — net constraints unchanged.

redocly lint passes, and the bundle keeps the component with all 11 properties and the required constraint.

✍️ Drafted by Claude Code

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 16, 2026
@vdusek vdusek self-assigned this Jul 16, 2026
@github-actions github-actions Bot added this to the 145th sprint - Tooling team milestone Jul 16, 2026
@apify-service-account

apify-service-account commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🗑️ Preview for this PR was deleted.

@apify-service-account

This comment was marked as outdated.

@vdusek vdusek closed this Jul 16, 2026
@vdusek vdusek reopened this Aug 21, 2026
@vdusek
vdusek force-pushed the fix/request-without-id-bundling branch from 3a96e7d to 767ee67 Compare August 21, 2026 17:37
@vdusek vdusek changed the title fix: Preserve RequestWithoutId schema and its required fields in the bundled OpenAPI spec fix(openapi): Preserve RequestWithoutId and its required fields when bundling Aug 21, 2026
@vdusek
vdusek requested a review from Pijukatel August 21, 2026 18:21
@vdusek
vdusek marked this pull request as ready for review August 21, 2026 18:24
required:
- uniqueKey
- url
# Wrapped in a single-member `allOf` so that bundling keeps this component. A bare `$ref` with sibling keys is a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the comment can be just in the description of this PR

@vdusek
vdusek merged commit 37a919d into master Aug 24, 2026
16 checks passed
@vdusek
vdusek deleted the fix/request-without-id-bundling branch August 24, 2026 08:58
vdusek added a commit to apify/apify-client-python that referenced this pull request Aug 25, 2026
…#1026)

`add_request` and `batch_add_requests` sent request fields snake_cased.
The API declares its write bodies with `additionalProperties: false`, so
it rejected the whole write with HTTP 400 — a request carrying
`user_data`, `no_retry`, `retry_count`, `loaded_url`, `error_messages`,
or `handled_at` could not be added at all. The identical dict passed to
`update_request` worked:

```python
add_request     -> 400  {"uniqueKey": "k", "url": "...", "user_data": {...}, "no_retry": true}
update_request  -> 200  {"uniqueKey": "k", "url": "...", "userData":  {...}, "noRetry":  true}
```

The client was using `RequestDraft` (the spec's response-only schema for
`unprocessedRequests`, which declares only
`id`/`unique_key`/`url`/`method` and leaves the rest to `extra='allow'`)
as its input model. The spec actually declares both add-request bodies
as `RequestWithoutId`, now correctly generated as its own model since
apify-docs#2774 fixed the spec bundler dropping its identity — no custom
postprocessing needed. Upstream spec fix
([apify-docs#2774](apify/apify-docs#2774)) is
closed.

Two things to know:

- **Validation narrows.** The newly declared fields are validated
instead of passed through, so `retry_count='abc'` or a naive
`handled_at` now raise `ValidationError` instead of a 400 from the API.
- **`update_request`'s timestamp format changes** (`fa77d88`):
`mode='json'` emits ISO 8601 where python mode emitted `2019-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.

Integration tests round-trip every field through both add paths against
the live API; they fail on master with `InvalidRequestError`.

*✍️ Drafted by Claude Code*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants