would be nice to support object in directive parsing.
Yup currently allow you to define a specific error message string quite easily for required.
directives: {
required: {
errorMessage: "defined"
}
}
sadly this seems to be the equivalent in zod and it does not work. If we put the content between quotes we end up with this z.string().string("{required_error: 'The field is required.'}").
This is having two issues:
- zod doesn't support multi chaining the same method so would need to remove the first one
- the object is between quote :/
directives: {
required: {
errorMessage: ["string", { required_error: '$1' }]
}
}
Had a quick look but sadly my understanding of the lib is quite small so haven't been able to add that feature.
would be nice to support object in directive parsing.
Yup currently allow you to define a specific error message string quite easily for required.
sadly this seems to be the equivalent in zod and it does not work. If we put the content between quotes we end up with this
z.string().string("{required_error: 'The field is required.'}").This is having two issues:
Had a quick look but sadly my understanding of the lib is quite small so haven't been able to add that feature.