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

fix: isAsync is deprecated #7

Closed
wants to merge 1 commit into from
Closed

Conversation

paullbn
Copy link

@paullbn paullbn commented Sep 9, 2019

Hello,

This PR solves the following mongoose deprecation warning:

DeprecationWarning: Mongoose: the `isAsync` option for custom validators is deprecated.
Make your async validators return a promise instead: https://mongoosejs.com/docs/validation.html#async-custom-validators

Paul

Copy link
Contributor

@niftylettuce niftylettuce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually doesn't need to be asynchronous at all nor return a Promise, I think we can just throw an error?

@codecov
Copy link

codecov bot commented Sep 9, 2019

Codecov Report

Merging #7 into master will decrease coverage by 1.25%.
The diff coverage is 80%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7      +/-   ##
=======================================
- Coverage   81.25%   80%   -1.25%     
=======================================
  Files           1     1              
  Lines          48    50       +2     
=======================================
+ Hits           39    40       +1     
- Misses          9    10       +1
Impacted Files Coverage Δ
index.js 80% <80%> (-1.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2536dc2...6a32a09. Read the comment docs.

@paullbn
Copy link
Author

paullbn commented Sep 9, 2019

Ok, i thought there was a reason i didn't know that the validator was asynchronous with isAsync set to true, so i've just put it in a promise.

I'll update the PR as soon as i can

@luluhoc
Copy link

luluhoc commented Dec 31, 2019

Will you update it?

@niftylettuce
Copy link
Contributor

PR welcome!

@niftylettuce
Copy link
Contributor

v2.0.2 has been released to npm with this fixed

npm install mongoose-slug-plugin@latest

or with yarn:

yarn add mongoose-slug-plugin@latest

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

Successfully merging this pull request may close these issues.

3 participants