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

How to do struct validation for slice of strings #475

Open
dancb10 opened this issue Apr 15, 2022 · 0 comments
Open

How to do struct validation for slice of strings #475

dancb10 opened this issue Apr 15, 2022 · 0 comments

Comments

@dancb10
Copy link

dancb10 commented Apr 15, 2022

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?

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

1 participant