fix(templates/client): correctly nil check query parameters#2237
Merged
jamietanna merged 1 commit intomainfrom Feb 24, 2026
Merged
fix(templates/client): correctly nil check query parameters#2237jamietanna merged 1 commit intomainfrom
jamietanna merged 1 commit intomainfrom
Conversation
|
Required label not found on this PR. |
As a fix similar to c4ba545, we had cases where the global `prefer-skip-optional-pointer` could lead to not nil checking when we should have been. The previous behaviour would lead to incorrectly converting i.e. `user_ids=nil` to `user_ids[]=`, which is not correct. To do this, we can add the same helper functions that we have elsewhere.
d7a4dbd to
238c365
Compare
mromaszewicz
approved these changes
Feb 24, 2026
mromaszewicz
approved these changes
Feb 24, 2026
mromaszewicz
added a commit
to mromaszewicz/oapi-codegen
that referenced
this pull request
Feb 28, 2026
…late (oapi-codegen#2238) 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
added a commit
to mromaszewicz/oapi-codegen
that referenced
this pull request
Feb 28, 2026
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
added a commit
that referenced
this pull request
Mar 2, 2026
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. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
As a fix similar to c4ba545, we had
cases where the global
prefer-skip-optional-pointercould lead to notnil checking when we should have been.
The previous behaviour would lead to incorrectly converting i.e.
user_ids=niltouser_ids[]=, which is not correct.To do this, we can add the same helper functions that we have elsewhere.