Skip to content

fix: use RequiresNilCheck for all params#2263

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-2238
Mar 2, 2026
Merged

fix: use RequiresNilCheck for all params#2263
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-2238

Conversation

@mromaszewicz

@mromaszewicz mromaszewicz commented Feb 28, 2026

Copy link
Copy Markdown
Member

Fixes #2238

PR #2237 fixed query parameters to use RequiresNilCheck instead of HasOptionalPointer for nil-check guards, but the same bug remained in the header and cookie parameter sections of client.tmpl. This caused optional array params (e.g. []string) to be sent even when nil, because prefer-skip-optional-pointer removes the pointer wrapper and HasOptionalPointer returns false, skipping the nil check entirely.

@mromaszewicz mromaszewicz requested a review from a team as a code owner February 28, 2026 16:07
PR oapi-codegen#2237 fixed query parameters to use RequiresNilCheck instead of
HasOptionalPointer for nil-check guards, but the same bug remained in
the header and cookie parameter sections of client.tmpl. This caused
optional array params (e.g. []string) to be sent even when nil, because
prefer-skip-optional-pointer removes the pointer wrapper and
HasOptionalPointer returns false, skipping the nil check entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mromaszewicz mromaszewicz changed the title fix: use RequiresNilCheck for header and cookie params in client temp… fix: use RequiresNilCheck for all params Feb 28, 2026

@jamietanna jamietanna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for following up on this

@mromaszewicz mromaszewicz merged commit c966b37 into oapi-codegen:main Mar 2, 2026
26 checks passed
@mromaszewicz mromaszewicz deleted the fix/issue-2238 branch March 2, 2026 14:17
@mromaszewicz mromaszewicz added the bug Something isn't working label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure all prefer-skip-optional-pointer cases are checked

2 participants