Skip to content

feat: response headers - #16

Merged
dotkas merged 4 commits into
mainfrom
feat/c5-response-headers
Jul 7, 2026
Merged

feat: response headers#16
dotkas merged 4 commits into
mainfrom
feat/c5-response-headers

Conversation

@dotkas

@dotkas dotkas commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 7, 2026 07:31

Copilot AI left a comment

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.

Pull request overview

This PR adds first-class support for OpenAPI-declared response headers in the axum server generator, lowering them into IR and emitting them as fields on response enum variants that are written into the HeaderMap during IntoResponse.

Changes:

  • Lower declared response headers into IR (ResponseCase.headers / ResponseHeader) and validate supported shapes.
  • Emit response variants with named header fields and best-effort header insertion in IntoResponse.
  • Add fixtures + snapshot/compile tests and document the feature/unsupported cases in the README.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Documents response-header support and unsupported header shapes/refs.
crates/oapi-codegen/src/ir.rs Extends response IR with ResponseHeader and per-case headers.
crates/oapi-codegen/src/lower/paths.rs Lowers response headers, adds header-name validation helper, and threads headers into response cases.
crates/oapi-codegen/src/emit/axum.rs Emits header-bearing response variants and inserts headers into the response HeaderMap.
crates/oapi-codegen/tests/fixtures/server_response_headers.yaml Adds a supported fixture exercising required/optional response headers.
crates/oapi-codegen/tests/generated/server_response_headers.rs Snapshot of newly generated server output for response headers.
crates/oapi-codegen/tests/generated_compiles.rs Includes the new generated module and adds a compile-time behavior test for header writing.
crates/oapi-codegen/tests/fixtures/server_unsupported_object_response_header.yaml Adds an unsupported fixture for object-typed response headers.
crates/oapi-codegen/tests/fixtures/server_unsupported_bytes_response_header.yaml Adds an unsupported fixture for byte/binary response headers.
crates/oapi-codegen/tests/coverage.rs Registers the new supported/unsupported fixtures in coverage enforcement.

Comment thread crates/oapi-codegen/src/emit/axum.rs
Comment thread crates/oapi-codegen/src/lower/paths.rs
Comment thread crates/oapi-codegen/src/lower/paths.rs Outdated

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread crates/oapi-codegen/tests/generated_compiles.rs Outdated
Comment thread crates/oapi-codegen/tests/generated_compiles.rs Outdated
Comment thread crates/oapi-codegen/tests/coverage.rs

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread crates/oapi-codegen/src/lower/paths.rs
@dotkas
dotkas enabled auto-merge (squash) July 7, 2026 08:22
@dotkas
dotkas merged commit 2e45aca into main Jul 7, 2026
5 checks passed
@dotkas
dotkas deleted the feat/c5-response-headers branch July 7, 2026 08:22
@dotkas dotkas removed the released label Jul 16, 2026
@alchemaxinc alchemaxinc deleted a comment from alchemax-housekeeper Bot Jul 16, 2026
@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0-dev.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants