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
checkNoUnknown() #927
Labels
Milestone
Comments
Would love to see something like this if there is a possibility for it! |
I'm using a schema but this seems to work quite well const schema: Schema = {
avatar: {
in: ['body'],
isURL: true,
optional: { options: { nullable: true } },
},
};
const schemaKeys = Object.keys(schema);
await checkSchema({
...schema,
'*': {
in: ['body'],
custom: {
options: (field, { path }) => {
if (!schemaKeys.includes(path)) {
throw new Error(`Unknown field: ${path}`);
}
return true;
},
},
},
}).run(req); |
2 tasks
This is coming to v7 🙂 |
Hi hi, https://github.com/express-validator/express-validator/releases/tag/v7.0.0 is out with a fix for this 🙂 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I would like to add this to the v4+ APIs, not to the legacy APIs as they are difficult to implement, modularise and type.
My API suggestion for now is:
Any better names? 🤔
Originally posted by @gustavohenke in #266 (comment)
Did you added this feature for the library?
The text was updated successfully, but these errors were encountered: