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

Validate object().shape() with ref and abortEarly false #409

Closed
samuelsantia opened this issue Dec 31, 2018 · 1 comment
Closed

Validate object().shape() with ref and abortEarly false #409

samuelsantia opened this issue Dec 31, 2018 · 1 comment

Comments

@samuelsantia
Copy link
Contributor

Hi there,

I have schema that needs duplicate a field value in other field.
Imagine:

const schema = yup.object().shape({
  myProp: yup.string().required(),
  myDupProp: yup.ref('myProp'),
  otherProp: yup.string().required()
})

The problem is when I try validate with abortEarly turned off I got the Error TypeError: promise.then is not a function

Debugging it I watch that in object _validate method if the field don't exists or don't has validate method it returns true value, breaking the Promise.all of runValidations utils.

I think if field exists it should return Promise.resovle(true) to don't break Promise chain of util.

What do you think?
If you want I can try to do a pull request to fix it (it would be my first one :)

@maksimsemenov
Copy link

I'm seeing a similar issue when using .when() with abortEarly: false. I'm getting the same error: TypeError: promise.then is not a function.

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

3 participants