Skip to content

Similar keys in object schema causing field to use the wrong validation #2252

Description

@webdevnerdstuff

Describe the bug
When there are similar key's in the validation schema, it is causing it to not use the incorrect validation. I think this is a yup issue not a vee-validate issue?

To Reproduce

  1. Open https://stackblitz.com/edit/vitejs-vite-l6n3zb?file=src%2Fcomponents%2FHelloWorld.vue
  2. Click on "Submit" in the example
  3. Notice it's using the fooBar validation not foo
  4. Remove or comment out line 9.
  5. Click on "Submit" in the example
  6. Notice it's using the fooBiz validation not foo

ex. schema

const schema = object({
  foo: string().required(isRequired('Foo')),
  fooBar: string().required(isRequired('Foo Bar')),
  fooBiz: string().required(isRequired('Foo Biz')),
});

Expected behavior
It should use the correct validation set.

Platform (please complete the following information):

  • Yup Version ^1.4.0
  • VeeValidate Version ^4.14.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions