Skip to content

Optional response header#1412

Closed
ShouheiNishi wants to merge 9 commits into
oapi-codegen:mainfrom
ShouheiNishi:fix/optional-response-header
Closed

Optional response header#1412
ShouheiNishi wants to merge 9 commits into
oapi-codegen:mainfrom
ShouheiNishi:fix/optional-response-header

Conversation

@ShouheiNishi

@ShouheiNishi ShouheiNishi commented Dec 28, 2023

Copy link
Copy Markdown
Contributor

To fix issue #1301, when header is optional, field for this is generate as pointer type. When this field is nil, corresponding header is not set in functions Visit*.
However, this change introduce some incompatibility.
So we add compatibility option.

And this PR included PR #1411.

@ShouheiNishi ShouheiNishi marked this pull request as ready for review December 28, 2023 04:16
@mromaszewicz

Copy link
Copy Markdown
Member

Thank you for submitting this PR, @ShouheiNishi — but we need to close it because it has been superseded by #2301 (commit a4c36dc2), which landed all three elements you proposed: pointer types for optional headers (*T via GoTypeDef() in pkg/codegen/operations.go), nil-guards on w.Header().Set() in the strict-server templates, and a HeadersImplicitlyRequired compatibility flag for users relying on the old behavior. The originally-linked issue #1301 is now fixed.

Apologies for the long wait. We really do appreciate the contribution — it pointed at the right problem and the right shape of fix.

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.

2 participants