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
feat(checkSchema): run imperatively #977
feat(checkSchema): run imperatively #977
Conversation
src/middlewares/schema.spec.ts
Outdated
}, | ||
}); | ||
|
||
expect(schema.run(req)).resolves; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs an await
or return
-- otherwise it may fail out of band
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot the return
🤦🏻♂️
src/middlewares/schema.ts
Outdated
@@ -59,7 +59,7 @@ const validLocations: Location[] = ['body', 'cookies', 'headers', 'params', 'que | |||
const protectedNames = ['errorMessage', 'in']; | |||
|
|||
export function checkSchema(schema: Schema, defaultLocations: Location[] = validLocations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we provide a custom type here?
E.g.
ValidationChain[] & { run(req: Request): Promise<unknown> }
Description
Closes #822
To-do list