Feat: add tag to skip namespace in embedded structures#1426
Conversation
|
@deankarn I implemented this behaviour in #1567
|
## Fixes Or Enhances When `RegisterTagNameFunc` returns `""` (typically for `json:"-"` or equivalent), the field currently falls back to the struct field name in error namespaces, defeating the tag-name remapping. This PR adds the WithTagNameFuncBlankOmit option that preserves the blank and omits the field from the error namespace - nested struct levels collapse, and leaf field namespaces trim the trailing separator. Gated behind an option for v10 backward compatibility. According to @deankarn this was always meant to be the behaviour (see #1426 (comment)) so I've gone off the assumption this will be the default in v11 and followed the example of `WithRequiredStructEnabled`. **Make sure that you've checked the boxes below before you submit PR:** - [x] Tests exist or have been written that cover this particular change. @go-playground/validator-maintainers


Enhances
Introducing new
skipnsvalidate tag, that allows to skip the name of embedded struct, when printing invalid field namspace.See #1413 for more extensive examples and discussion.
Make sure that you've checked the boxes below before you submit PR:
@go-playground/validator-maintainers
Fixing #1413 and #776