Skip to content

Commit

Permalink
docs: added zod refine and superrefine warning closes #4338
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Jun 29, 2023
1 parent 32537e1 commit aace776
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/src/pages/guide/composition-api/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ Here is a full example using zod with `useForm`:

<Repl files={{ 'App.vue': 'CompositionZodBasic' }} client:only />

<DocTip title="refine/superRefine">

There is a known issue with Zod's `refine` and `superRefine` not executing whenever some object keys are missing which is common with forms. This is not an issue with vee-validate as it is a design choice in Zod at the moment. Refer to [this issue](https://github.com/logaretm/vee-validate/issues/4338) for explanations and further reading.

</DocTip>

### Validating with global validators

Another option is using `@vee-validate/rules` which have been historically bundled with past versions of vee-validate. It includes rules that can be defined globally and then used anywhere using Laravel-like string expressions.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/pages/guide/composition-api/typed-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ handleSubmit(submitted => {
});
```

<DocTip title="refine/superRefine">

There is a known issue with Zod's `refine` and `superRefine` not executing whenever some object keys are missing or not filled which is common with forms. This is not an issue with vee-validate as it is a design choice in Zod at the moment. Refer to [this issue](https://github.com/logaretm/vee-validate/issues/4338) for explanations and further reading.

</DocTip>

### Zod default values

You can also define default values on your zod schema directly and it will be picked up by the form:
Expand Down
6 changes: 6 additions & 0 deletions docs/src/pages/integrations/zod-schema-validation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,9 @@ const onSubmit = handleSubmit(values => {
You can find more information on how typed schemas work in vee-validate [here](/guide/composition-api/typed-schema#zod)

</DocTip>

<DocTip title="refine/superRefine">

There is a known issue with Zod's `refine` and `superRefine` not executing whenever some object keys are missing which is common with forms. This is not an issue with vee-validate as it is a design choice in Zod at the moment. Refer to [this issue](https://github.com/logaretm/vee-validate/issues/4338) for explanations and further reading.

</DocTip>

0 comments on commit aace776

Please sign in to comment.