Repository navigation
fix: report binding errors for exploded form objects - #195
Merged
mromaszewicz merged 1 commit intoNov 22, 2026
Merged
Conversation
When a property of a form style, exploded object query parameter was present but could not be bound, bindParamsToExplodedObject returned the error along with fieldsPresent=false. Both callers tested fieldsPresent first, so the error was discarded and the parameter was handled as though it were absent: an optional parameter was silently left unbound, valid properties included, and a required one produced a misleading RequiredParameterError. Check the error first, in BindQueryParameterWithOptions and BindRawQueryParameterWithOptions. A malformed property, such as `limit=abc` for an integer or a primitive specified twice, now fails the request the way it does for a parameter which is not an object. Part of oapi-codegen#193 Co-Authored-By: Claude Fable 5.2 <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.
Part of #193 (defect 2 of 2).
Problem
When a property of a
style: form,explode: trueobject query parameter is present but can not be bound,bindParamsToExplodedObjectreturns the error together withfieldsPresent == false. Both callers (BindQueryParameterWithOptionsandBindRawQueryParameterWithOptions) testedfieldsPresentbeforeerr, so the error was discarded and the parameter was handled as though it were absent:?cursor=xyz&limit=abcreached the handler with no filters at all;RequiredParameterError.This dates back to the "Fix optional binding" change in 2022. The comment above the check has always read "If no fields were set, and there is no error", so this restores the intended behavior.
Fix
Check
errfirst in both callers.Behavior change
For an optional exploded form object, a request with a malformed property now fails with a binding error (a 400 in generated servers) where it previously succeeded with the whole parameter dropped. The affected inputs are:
limit=abcfor an integer;This matches what already happens for the same malformed value in a parameter that is not an object. Required parameters already failed, and now fail with an accurate message. Worth a line in the release notes.
The companion PR for the first defect in #193 (array properties) is independent of this one and the two merge cleanly in either order.
🤖 Generated with Claude Code