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

array.min not validating when abortEarly: false #1130

Closed
lenartbezek opened this issue Nov 30, 2020 · 1 comment
Closed

array.min not validating when abortEarly: false #1130

lenartbezek opened this issue Nov 30, 2020 · 1 comment

Comments

@lenartbezek
Copy link

Describe the bug

array.min does not throw any error when abortEarly: false option is specified.

To Reproduce
RunKit: https://runkit.com/lench/yup-array-validation

const Yup = require("yup");
const { expect } = require("chai")

const schema = Yup.object().shape({
    items: Yup.array()
        .of(Yup.string())
        .min(1, 'must-have-one-item'),
});

const value = {
    items: [],
};

try {
    schema.validateSync(value, { abortEarly: false });
    expect.fail("Should throw error.");
} catch (error) {
    if (error instanceof Yup.ValidationError) {
        expect(error.errors).to.deep.equal([
            'must-have-one-item'
        ]);
    } else {
        throw error;
    }
}

Expected behavior

Should throw error 'must-have-one-item';

Platform:

  • Node.js, tested in v14.4.0 and v15.3.0

Additional context
Does not work in Yup v0.31.0.
Worked fine in Yup v0.29.3.

@jquense
Copy link
Owner

jquense commented Nov 30, 2020

#1127

@jquense jquense closed this as completed Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants