Skip to content

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

@hanzelkatomas

Description

@hanzelkatomas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugUnintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions