Skip to content

Preserve whole-body binary downloads and union schemas - #84

Merged
kdubb merged 2 commits into
mainfrom
codex/binary-response-parity
Oct 16, 2026
Merged

kdubb merged 2 commits into
mainfrom
codex/binary-response-parity

Conversation

@kdubb

@kdubb kdubb commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Whole-body binary downloads currently pass through JSON/text decoding when the response advertises those media types, altering bytes or failing before the generated schema can decode them.

Add RequestSpec.binaryResponse so FetchTransport preserves raw bytes for both result and response operations and accepts download media types without registered codecs. Resolve binary schema definitions with the existing raw-byte schema policy so aliases and all-binary unions retain schema validation. Mixed unions, structured binary fields, HTTP problems, and typed 204/205 handling keep their existing paths.

Companion generator change: outfoxx/sunday-generator#275. Related original issue: outfoxx/sunday-python#12.

Coordinated release dependency: publish a Sunday TypeScript runtime version containing this change, then pin that version in generator PR #275 before releasing generated clients. Existing generated clients need regeneration to emit the binary-response flag. No runtime version has been published by this PR.

Validation:

  • ESLint, source/test type checking, and package build passed.
  • All 804 runtime tests passed, including exact-byte, empty-body, binary-union, mixed-union, and problem-response regression coverage.
  • Compiler-backed generated TypeScript clients from OpenAPI and RAML passed against this built runtime through SUNDAY_TYPESCRIPT_PATH.

Add explicit request metadata for raw response decoding and media negotiation. Resolve binary schema definitions with the raw-byte policy and cover bytes, empty bodies, unions, and errors. Document the generated-client contract.
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the latest tests address the previous coverage gap.

Summary

Adds RequestSpec.binaryResponse so whole-body downloads keep their original bytes while still applying the response schema.

  • Binary downloads now keep their bytes across response media types.

Reviews (2) 路 Last reviewed commit: "Test explicit binary download accept typ..." 路 Reviewed by Greptile

Comment thread test/binary-response.test.ts
Cover image/png and application/x-download without registered media decoders. Verify execute and response preserve bytes and send the exact Accept header; mutation testing confirms the accept override is required.
@sonarqubecloud

Copy link
Copy Markdown

@kdubb
kdubb merged commit e5bf92c into main Oct 16, 2026
3 checks passed
@kdubb
kdubb deleted the codex/binary-response-parity branch October 16, 2026 01:30
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.

1 participant