Skip to content

fix: bind uuid.UUID fields in deepObject parameters - #171

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
youdie006:deepobject-array-text-unmarshaler
Nov 10, 2026
Merged

mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
youdie006:deepobject-array-text-unmarshaler

Conversation

@youdie006

Copy link
Copy Markdown
Contributor

#45 (for #44) added a TextUnmarshaler check to the struct branch of assignPathValues so that types like uuid.UUID bind. But uuid.UUID is [16]byte, an array kind, so it never reaches that branch, and a deepObject parameter with a format: uuid field still fails:

?filter[entity]=6ba7b810-9dad-11d1-80b4-00c04fd430c8
error assigning value to destination: error assigning field [entity]: unhandled type: uuid.UUID

This adds a reflect.Array case that uses UnmarshalText when the type implements it, as BindStringToObject already does (bindstring.go). Other arrays still return unhandled type.

TestDeepObject_UUIDFields covers uuid.UUID and *uuid.UUID fields, an invalid UUID, and a plain [2]string. The first two rows fail on main. go test ./..., go vet and golangci-lint (2.13.2 locally, CI uses 2.15.0) pass.

Written with AI assistance (Claude); I have reviewed the change.

uuid.UUID is a [16]byte array, so it never reached the TextUnmarshaler check that oapi-codegen#45 added to the struct branch and still failed with "unhandled type: uuid.UUID". Handle array kinds that implement encoding.TextUnmarshaler, as BindStringToObject already does.
@youdie006
youdie006 requested a review from a team as a code owner October 27, 2026 16:20
@mromaszewicz mromaszewicz added the enhancement New feature or request label Nov 10, 2026
@mromaszewicz
mromaszewicz merged commit 1b74ca8 into oapi-codegen:main Nov 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants