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

meta.required doesn't work on number().required() schema in yup #4598

Closed
3 of 5 tasks
hanzelkatomas opened this issue Dec 14, 2023 · 1 comment · Fixed by #4599
Closed
3 of 5 tasks

meta.required doesn't work on number().required() schema in yup #4598

hanzelkatomas opened this issue Dec 14, 2023 · 1 comment · Fixed by #4599
Labels
🐛 bug Unintended behavior

Comments

@hanzelkatomas
Copy link

hanzelkatomas commented Dec 14, 2023

What happened?

I really appreciate your last feature, which added meta.required, which is returned on useField(), when I implemented new design I noticed the meta.required is always false, when I have input which stores value in Number type and I use number().required() as validation rule in yup.

Also:
Couldn't be meta.required reactive, so value of it will change depending on when() is at this moment true or false? It would be nice so my design of inputs would change (I would reactively change inputs design) depending if input is required or not.

Reproduction steps

  1. useForm with validation on input with number().required()
  2. Meta required seems to be false, however works without problem on `string().required()
    ...

You can change validation type in schema from number() to string() and meta will be correct

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/vue-nqdv8g?file=src%2FApp.vue

Code of Conduct

@logaretm logaretm added the 🐛 bug Unintended behavior label Dec 14, 2023
@logaretm
Copy link
Owner

Looks like there is a more reliable way to figure that out through spec property. Thanks for reporting this.

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

Successfully merging a pull request may close this issue.

2 participants