govalidator icon indicating copy to clipboard operation
govalidator copied to clipboard

How to do struct validation for slice of strings

Open dancb10 opened this issue 2 years ago • 0 comments

Hello, I have tried validating struct element which is slice of strings. I've tried using the following functions but somehow they don't work as expected: "range(min|max)": Range, "length(min|max)": ByteLength, "runelength(min|max)": RuneLength, "stringlength(min|max)": StringLength,

How can you say my slice cannot have more than 5 elements and each element cannot be more than 20 alpha characters? Can you do this with the validator and using struct tags?

dancb10 avatar Apr 15 '22 10:04 dancb10