Skip to content

Add missing required parameter detection#135

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-134
Jun 20, 2026
Merged

Add missing required parameter detection#135
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-134

Conversation

@mromaszewicz

Copy link
Copy Markdown
Member

Closes: #134

The exploded form path bound struct-typed query params (e.g. types.Date, time.Time) via bindParamsToExplodedObject and returned nil when no fields were present, dropping the required check that the slice and primitive cases already perform. A missing required date param therefore passed silently instead of returning a RequiredParameterError.

Honor required in the reflect.Struct case of both
BindQueryParameterWithOptions and BindRawQueryParameter, and add regression tests for the absent-required case.

Closes: oapi-codegen#134

The exploded form path bound struct-typed query params (e.g. types.Date,
time.Time) via bindParamsToExplodedObject and returned nil when no fields
were present, dropping the required check that the slice and primitive
cases already perform. A missing required date param therefore passed
silently instead of returning a RequiredParameterError.

Honor required in the reflect.Struct case of both
BindQueryParameterWithOptions and BindRawQueryParameter, and add
regression tests for the absent-required case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mromaszewicz mromaszewicz requested a review from a team as a code owner June 20, 2026 06:05
@mromaszewicz mromaszewicz added the bug Something isn't working label Jun 20, 2026
@mromaszewicz mromaszewicz merged commit 7afeea8 into oapi-codegen:main Jun 20, 2026
14 checks passed
@mromaszewicz mromaszewicz deleted the fix/issue-134 branch June 20, 2026 06:08
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.

Required not enforced for struct-typed query params (e.g. date)

1 participant