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?
I basically want each element of
S
to be eithera
orb
, but looks likein
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?