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

[Question] Can in be used with slice in tag validation? #266

Open
chengc-sa opened this issue Jun 7, 2024 · 0 comments
Open

[Question] Can in be used with slice in tag validation? #266

chengc-sa opened this issue Jun 7, 2024 · 0 comments
Labels
question Further information is requested

Comments

@chengc-sa
Copy link

type A struct{
   S []string `validate:"required|in:a,b"`
}

I basically want each element of S to be either a or b, but looks like in validation in the tag by default does not support validating a slice, I know you can do it using the programmatic validation (StringRule()), but I want to stick with tag validation, is there any workaround for it?

@inhere inhere added the question Further information is requested label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants