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

resolvers skip asynchronous validators #442

Open
m-lyon opened this issue Apr 23, 2024 · 0 comments
Open

resolvers skip asynchronous validators #442

m-lyon opened this issue Apr 23, 2024 · 0 comments

Comments

@m-lyon
Copy link

m-lyon commented Apr 23, 2024

The validateDoc function used in many resolvers, e.g. updateById, createOne, found here will call doc.validateSync for mongoose >= v7. validateSync does not run asynchronous validators, and instead skips them. This leads to validation being silently skipped within this package.

Since validateDoc is an asynchronous function, and awaits for validations in mongoose < v7, it seems that there is no good reason to not await for validation in the >= v7 case as well.

Happy to make a pull request if the maintainers agree.

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

No branches or pull requests

1 participant