Open
Description
What happened?
When i use transform on my zod schema, the property meta.required of any field is setted to false. The validation of the fields works normally, but i want to use this property to insert a hint on the label of the field to the user knows that's a required field.
I took the code in the documentation Form-Level Validation Composition API as a basis for the example, just adding the transform to the schema
const validationSchema = toTypedSchema(zod.object({
email: zod.string()
.min(1, { message: 'This is required' })
.email({ message: 'Must be a valid email' }),
password: zod.string()
.min(1, { message: 'This is required' })
.min(8, { message: 'Too short' }),
}).transform((values) => {
return values;
})
);
Note: This behavior works correctly using validation with yup, meta.required is true when using transform and the field is required
Reproduction steps
- Execute the code to see the meta.required setted as false
- Delete the transform method on the schema and meta.required will be true
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
Demo link
https://stackblitz.com/edit/vitejs-vite-tdty9ujv
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
No labels