feat: preserve generated response headers - #140
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
adamcavendish
force-pushed
the
adamcavendish/preserve-response-headers
branch
from
July 31, 2026 08:15
63f6a08 to
d21b06e
Compare
- Retain backend-native response headers on successful and HTTP error paths - Generate collision-safe typed accessors for declared scalar headers - Resolve referenced response headers across OpenAPI 3.0, 3.1, and 3.2 - Cover malformed values, reference cycles, runtime behavior, and goldens
adamcavendish
force-pushed
the
adamcavendish/preserve-response-headers
branch
from
July 31, 2026 09:19
d21b06e to
e709c1a
Compare
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
Preserves response headers consistently across every generated client and adds optional typed accessors for OpenAPI-declared headers.
Problem
Successful responses did not expose headers consistently, Rust error handling converted headers through a lossy string vector, and referenced response-header components were dropped during lowering. This made headers such as
Retry-Afterunavailable or adapter-dependent.Behavior
Compatibility
Rust generated response structs now include a native
headersfield, andApiError::headers()returns the backend-nativeHeaderMapinstead ofVec<(String, String)>. Python retains existing body-only methods and adds collision-safe*_with_http_info()methods. Browser Fetch visibility still follows CORSAccess-Control-Expose-Headers.No package version or release metadata changes are included.
Validation
cargo fmt --all -- --checkjust clippyjust doc-checkjust bookjust test-alljust golden-checkjust golden-build-all