Skip to content

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