Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a tag validation method #1230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xgourmandin
Copy link

@xgourmandin xgourmandin commented Feb 14, 2024

Enhances

Use case description :

In an application where we let a user configure custom fields and validation, we want to make sure that the tag associated with the field is valid before using it (because the validation library panics if the tag is invalid, which is fine when the library is used with struct annotations, but not very nice when using methods Var, VarCtx, VarWithValue and VarWithValueCtx directly)

in order to validate a user validation tag input, I propose a new method that handles tag validation and returns an error if there is an invalid tag, allowing a library user to handle this error nicely.

The benefits of adding this here instead of in our codebase is that the tag list is always up to date and it handles custom validators too.

Make sure that you've checked the boxes below before you submit PR:

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

@go-playground/validator-maintainers

@xgourmandin xgourmandin requested a review from a team as a code owner February 14, 2024 10:49
@coveralls
Copy link

Coverage Status

coverage: 74.184% (+0.01%) from 74.172%
when pulling cbdba6f on xgourmandin:master
into b328f72 on go-playground:master.

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