Skip to content

fix: validate explicitly selected partial subtrees - #1665

Open
stareezy-1 wants to merge 1 commit into
go-playground:masterfrom
stareezy-1:fix/partial-struct-subtrees
Open

stareezy-1 wants to merge 1 commit into
go-playground:masterfrom
stareezy-1:fix/partial-struct-subtrees

Conversation

@stareezy-1

Copy link
Copy Markdown

Fixes Or Enhances

Fixes #1293: selecting a nested struct through StructPartial currently records the parent name but continues filtering every child by an exact name, so the selected struct's fields are never validated.

Track complete selections separately from traversal prefixes. A complete selection validates its descendants while sibling and explicitly selected leaf filtering remain intact. Existing dive and other validation tags remain authoritative. No wildcard, range, or new selector syntax is added.

Tests cover nested pointers, overlapping selections, slice/map elements, empty selections and validator-pool reuse. go test -race ./... and the CI-pinned golangci-lint v2.13.1 pass. The new regression fails on upstream before the fix.

Draft for review of the nested-selection behavior change.

  • Tests exist or have been written that cover this particular change.

AI disclosure required by CONTRIBUTING.md: Codex (GPT-6) assisted with this change.

@stareezy-1
stareezy-1 marked this pull request as ready for review October 9, 2026 08:19
@stareezy-1
stareezy-1 requested a review from a team as a code owner October 9, 2026 08:19
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.

Partial struct validation does not validate child structs

1 participant