How to handle nested object validation
I am using Zod to perform the validation, and I have confirmed, that all of the errors.
I have the following schema:
I have stepped through the code, and can confirm that when country, and region are missing, the two keys are created for "address.country", and "address.region",
You can even see the error message in the array when using looking at
The only way I can see to find the errors is to use the array of all error strings.
Is there a way I am missing to get the errors for "address", or specifically "address.country" ect.
(worth noting that when using
I have the following schema:
I have stepped through the code, and can confirm that when country, and region are missing, the two keys are created for "address.country", and "address.region",
You can even see the error message in the array when using looking at
form.state.errors, how ever you cannot access the errors for address. The only way I can see to find the errors is to use the array of all error strings.
Is there a way I am missing to get the errors for "address", or specifically "address.country" ect.
(worth noting that when using
form.getFieldInfo("adress") i get all the relevant information for this field except the errors, but calling form.getFieldInfo("address.country") returns instance of null,)