mirror of
https://github.com/gin-gonic/gin.git
synced 2026-05-03 09:38:12 +08:00
Types like uuid.UUID implement encoding.TextUnmarshaler but previously required an explicit `parser=encoding.TextUnmarshaler` struct tag to be used during form/query/URI binding. This meant ShouldBind/ShouldBindQuery would fail with unhelpful errors like: ["45e1f85e-bca5-458d-bd9c-c56edd8f847b"] is not valid value for uuid.UUID This change makes trySetCustom automatically check for encoding.TextUnmarshaler as a fallback after BindUnmarshaler, so any type implementing TextUnmarshaler (uuid.UUID, net.IP, custom types, etc.) works out of the box with no extra tags. Precedence order: 1. BindUnmarshaler (UnmarshalParam) 2. encoding.TextUnmarshaler (UnmarshalText) 3. Default type-based binding time.Time is explicitly excluded from automatic TextUnmarshaler handling since gin has dedicated time parsing with time_format, time_utc, and time_location struct tags. Fixes #2423 Signed-off-by: Varun Chawla <varun_6april@hotmail.com>