Skip to content

Fix nested field alias combinations - #309

Merged
pikanezi merged 1 commit into
gocarina:masterfrom
Rajvira10:fix/nested-field-alias-product
Nov 1, 2026
Merged

pikanezi merged 1 commit into
gocarina:masterfrom
Rajvira10:fix/nested-field-alias-product

Conversation

@Rajvira10

Copy link
Copy Markdown
Contributor

A nested field with parent tag csv:"primary,legacy" and child tag csv:"value" silently drops data imported under legacy.value: UnmarshalString("legacy.value\nkept\n", &rows) returns no error but leaves the field empty.

Move the key assignment outside the parent-alias loop so each parent combines with the original child aliases. The public regression fails before the fix and passes afterward. Tests also cover 24 alias combinations across value children, pointer children and deeper nesting, reject accumulated prefixes in strict mode, and preserve first-alias marshaling.

Compatibility: accidentally accepted headers such as legacy.primary.value stop matching; use legacy.value. Default mode ignores unmatched headers, while strict mode reports them.

Validation: full tests, race tests and go vet ./... passed on official Go 1.26.9 / Linux amd64. Formatting and diff checks passed; an independent review found no issues. Older Go versions and remote CI have not been verified.

AI assistance: Codex was used for investigation, implementation, tests and review.

@pikanezi
pikanezi merged commit 1258fa0 into gocarina:master Nov 1, 2026
1 check passed
@pikanezi

pikanezi commented Nov 1, 2026

Copy link
Copy Markdown
Member

Thank you

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