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

Can't get vee validate zod union schema to work properly #4204

Closed
2 of 5 tasks
VincEnterprise opened this issue Mar 29, 2023 · 1 comment
Closed
2 of 5 tasks

Can't get vee validate zod union schema to work properly #4204

VincEnterprise opened this issue Mar 29, 2023 · 1 comment
Labels
🐛 bug Unintended behavior

Comments

@VincEnterprise
Copy link

VincEnterprise commented Mar 29, 2023

What happened?

I'm trying to build a form with 2 values, either both are filled out or none. When the user fills out one, it should show an error for the other if it hasn't been filled out.

I'm trying to implement this functionality with zod's .or() function, see here for example:

https://stackoverflow.com/questions/74122007/require-none-or-both-fields-with-zod

Is there something I'm missing here? Because using the zod union schema with .safeParse() seems to give me the expected result.

Reproduction steps

  1. Go to stackblitz repro
  2. focus name field, and type a letter
  3. try to submit
  4. see there's no errror for the email field
    ...

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

https://stackblitz.com/edit/vee-validate-v4-dynamic-validation-triggers-6yevxj?file=src%2FApp.vue,package.json

Code of Conduct

@logaretm logaretm added the 🐛 bug Unintended behavior label Apr 15, 2023
@logaretm
Copy link
Owner

Thanks for reporting this, vee-validate isn't picking up union errors at the moment. I will work on it right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants