-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Is checkExact() with wildcards supported? #1242
Comments
Facing same challenge. checkExact does not work when request is validated for array level in checkSchema. |
Facing same problem here. I'm doing this: app.post(
"/signup",
checkExact([
body("addresses").isObject(),
body("addresses.*.number").isInt(),
body("siblings.*.name").notEmpty(),
]),
(req, res) => {
validationResult(req).throw()
res.json({
msg: "Sucess",
})
}
) but there is no throwed error when I send this: {
"addresses": {
"home": {
"number": 35
},
"work": {
"number": 501,
"wrong": "yes"
}
},
"siblings": [
{
"name": "Maria von Validator"
},
{
"name": "Checky McCheckFace"
}
]
}
|
I'm investigating |
Hey! @fedeci @gustavohenke Just hit this same issue. Is there a current work around this? Or should I manually implement the exact check? |
Running into the same issue when validating with checkSchema.
No error when passing:
|
Hi all,
quick question: Is the checkExact() middleware supported for wildcards?
E.g. consider the following scenario:
I need to validate a body that looks something like this:
-> So essentially an array of objects with an id and qty property.
I can nicely check for validity with the following chain
Adding
checkExact()
to the end of the chain above however does not seem to cause the following example to fail validation, despite it having one additional unwanted property (wrong
) in the second object:So I wonder: is this scenario even supported currently, or am I running into a bug (or maybe I am doing something wrong?)
thanks in advance
Kind regards,
Pano
The text was updated successfully, but these errors were encountered: