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

noUnknown() & nullable() broken in 0.28.4 #854

Closed
icflorescu opened this issue Apr 23, 2020 · 10 comments
Closed

noUnknown() & nullable() broken in 0.28.4 #854

icflorescu opened this issue Apr 23, 2020 · 10 comments

Comments

@icflorescu
Copy link
Contributor

This shouldn't fail, and it didn't prior to 0.28.4:

const schema = object({
  name: string()
}).nullable().noUnknown();

schema.validate(null) // this throws "Cannot convert undefined or null to object"

I'm guessing it has something to do with #579

To Reproduce

See error on 0.28.4: https://runkit.com/icflorescu/5ea1f46ebc48c6001a449316

Expected behavior

See it working correctly on 0.28.3: https://runkit.com/icflorescu/5ea1f8227abc65001a36be1f

Platform (please complete the following information):

  • Version 0.28.4
@icflorescu
Copy link
Contributor Author

It is related to #579.

const unknownKeys = unknown(this.schema, value);

const unknownKeys = unknown(this.schema, value) shouldn't happen before testing for value == null

@icflorescu
Copy link
Contributor Author

Do you want me to do a PR?

@jquense
Copy link
Owner

jquense commented Apr 23, 2020

sure!

@icflorescu
Copy link
Contributor Author

Can you please publish a new version on npm? Thanks a lot!

@Philipp91
Copy link
Contributor

+1 for a release

@icflorescu
Copy link
Contributor Author

Anything I can help with to speed up releasing the new version on npm?

@BenGale
Copy link

BenGale commented May 12, 2020

Any idea when this will be released?

@icflorescu
Copy link
Contributor Author

It was released 12 days ago, AFAIK.

@icflorescu
Copy link
Contributor Author

@BenGale Why, did you encounter the same problem? This should be gone for yup ^0.28.5...

@BenGale
Copy link

BenGale commented May 15, 2020

No sorry, all good now. I must have missed the release.

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

4 participants