Repository navigation
fix: bind array properties of exploded form objects - #194
Merged
mromaszewicz merged 1 commit intoNov 22, 2026
Merged
mromaszewicz merged 1 commit into
mromaszewicz merged 1 commit into
Conversation
An array property of a form style, exploded object query parameter repeats its name once per element (`orderBy=foo&orderBy=bar`), the same as a top level exploded array. bindParamsToExplodedObject treated every property as a primitive, so more than one value was rejected as "specified multiple times", and a single value failed because a string can not be bound to a slice. Slice fields, and pointers to them, now bind one element per value. Byte slices and slices which parse themselves through Binder or encoding.TextUnmarshaler keep binding from a single string. 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 1 of 2). Originally reported as oapi-codegen/oapi-codegen#476.
Problem
An array property of a
style: form,explode: trueobject query parameter repeats its name once per element, the same as a top-level exploded array:bindParamsToExplodedObjecttreated every property as a primitive, so this could never bind intoMore than one value was rejected as
field 'orderBy' specified multiple times, and a single value failed because a string can not be bound to a slice.Fix
Slice fields, and pointers to slices, now bind one element per value, through the same
bindSplitPartsToDestinationArrayused for top-level exploded arrays. Commas are not delimiters here, matching the top-level behavior.Slices that bind from a single string are left on the existing path:
[]byte, and types that parse themselves throughBinderorencoding.TextUnmarshaler.Compatibility
Additive only. Every input whose result changes previously failed to bind; nothing that binds today binds differently.
The companion PR for the second defect in #193 (binding errors being discarded by the callers) is independent of this one and the two merge cleanly in either order.
🤖 Generated with Claude Code