validate icon indicating copy to clipboard operation
validate copied to clipboard

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

Open chengc-sa opened this issue 8 months ago • 0 comments

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?

chengc-sa avatar Jun 07 '24 02:06 chengc-sa