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

builtin validator for json request #9

Open
Kilerd opened this issue Feb 24, 2023 · 0 comments
Open

builtin validator for json request #9

Kilerd opened this issue Feb 24, 2023 · 0 comments

Comments

@Kilerd
Copy link
Owner

Kilerd commented Feb 24, 2023

currently we have the Schematic derived macro to mark it can be described as a Parameter, but we wanna introduce a integrated way to validate the value coming from user input.
like the email must be match the email regex, like #[validation(regex="[a-zA-Z]+@[a-z]{2}.com")] , like the number must be in the range of 0-100 :#[validation(min=0, max=100)]

so it means that we need to inject into the trait FromRequest. add a new trait called Validator and then impl Validator for MyStruct then impl FromRequest for T where T: Validator

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

When branches are created from issues, their pull requests are automatically linked.

1 participant