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
Enforce request body match validation schema #1148
Comments
If you only care about the first level it's enough to use a custom validator
This is very basic, you can also validate the types here at the same time. Cheers. |
Thank you @tonysamperi but I would like to deep validate and ideally be integrated with express-validator ;) |
@erakis That's integrated! You can chain that validation with all the others... |
I agree with you that tweaking and learning to use the library a little bit exposes some powerful functionalities to users. What is probably not 100 percent accurate is documentation because it tends to only explain high level features (which in the end are the scope of this library). I'll see if I will finally be able to work on v7 along with docs updates this summer🤞 |
Cool. Although after all it wouldn't be bad having a ready validation to check request properties, for example with an option to ignore or block additional properties... |
It would, just be sure to open and develop it against the v7-features branch! |
Going to be addressed in v7 (see #1204) |
Hi hi, https://github.com/express-validator/express-validator/releases/tag/v7.0.0 is out with aforementioned fix 🙂 |
@fedeci
How to make sure the schema of the body is exactly of this form.
I mean if the body contains other fields than these (
name
,description
), then I want to signal them by raising an exception.Ex:
In this case, the validation should fail because the field
age
is not part of the wanted schema.Obviously, it's possible to create a custom task, but it would be a great asset to have this functionality in
express-validator
. Some kind ofmatchSchema(true)
?Duplicate of #1101 (comment) but this issue has been closed.
The text was updated successfully, but these errors were encountered: