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

[BUG] incompatibe with validate from github.com/go-playground/validator #1886

Open
Dexus opened this issue Sep 10, 2024 · 3 comments
Open

[BUG] incompatibe with validate from github.com/go-playground/validator #1886

Dexus opened this issue Sep 10, 2024 · 3 comments

Comments

@Dexus
Copy link

Dexus commented Sep 10, 2024

This Tool is incompatible with github.com/go-playground/validator

@XiXiangFiles
Copy link

Hi, can you provide some examples? My project also uses validators, but I haven't encountered your issue

@Dexus
Copy link
Author

Dexus commented Oct 1, 2024

@XiXiangFiles

go-playground/validator is using the struct tag validate

and your tools use it also, so it breaks on validations.

I will check that I provide a examlpe once I got an ok for it.

@ubogdan
Copy link
Contributor

ubogdan commented Oct 20, 2024

@Dexus Don't be lazy. You can decorate func (m *ModelName) Validate() errror for every model that requires validation and control validation from code.
Overwhelming the struct with tags may get very frustrating when you will need to have different validation behaviors for update and create operations.
Also, struct tags are evaluated at runtime using reflection which is not the most performant thing in Golang.

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

No branches or pull requests

3 participants