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

feat: Add defined() validation to mix #637

Merged
merged 2 commits into from
Feb 9, 2020

Conversation

talyssonoc
Copy link
Contributor

After seeing this comment #153 (comment) in an issue about the error when mixing required with nullable I thought it would be nice to have this validation.

Copy link
Owner

@jquense jquense left a comment

Choose a reason for hiding this comment

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

Just one small change and gtg. Thanks!

src/mixed.js Outdated
name: 'defined',
exclusive: true,
test(value) {
return this.schema._isDefined(value);
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we need the indirection here, since it's unlikely anyone will override this. Let's just do the check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, gonna do it!

Also, do you think I should implement a version of it for arrays as well? I ask it based in this comment #189 (comment)

Choose a reason for hiding this comment

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

@jquense @talyssonoc - Yes please for arrays - I exactly need this.

Choose a reason for hiding this comment

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

^Wait - does this need more work for arrays? Seems to be working fine for me.

@jquense
Copy link
Owner

jquense commented Feb 9, 2020

thanks!

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.

6 participants