Skip to content

Conversation

kankankanp
Copy link

Summary

Addresses issue #2746 by adding support for binding nested structs, arrays, and pointer fields from form data in Echo.
This enhancement allows developers to seamlessly bind complex, deeply nested web form data (such as team.members[0].name=Alice) directly to Go structs with nested slices, pointer fields, and multiple levels of depth.

Changes

  • Implements recursive parsing and binding for form keys using dot notation and array indices (e.g. team.members[0].name).
  • Supports deeply nested structs, slices, and pointer fields within form binding.
  • Updates binder logic to handle keys like winner.players[1].role=Forward and loser.leaders[0].name=Charlie.
  • Adds comprehensive tests for nested, pointer, sparse, and edge-case bindings.

Benefits

  • Enables direct binding of complex HTML form data to Go structs, reducing manual mapping in user applications.
  • Addresses feature requests such as #2746.
  • Maintains backward compatibility with existing flat struct form bindings.
  • Improves ergonomics for web forms with nested data in Echo.

Test plan

  • All new and existing tests pass
  • Linting passes
  • Manual verification with sample Echo server and curl requests
  • No behavioral changes for existing flat form bindings

@aldas aldas self-assigned this Oct 12, 2025
Copy link

codecov bot commented Oct 12, 2025

Codecov Report

❌ Patch coverage is 81.60920% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.18%. Comparing base (f24aaff) to head (1555007).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
bind.go 81.60% 11 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2834      +/-   ##
==========================================
- Coverage   93.25%   93.18%   -0.07%     
==========================================
  Files          39       39              
  Lines        4652     4753     +101     
==========================================
+ Hits         4338     4429      +91     
- Misses        218      225       +7     
- Partials       96       99       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants