#Zod Validate

1 messages · Page 1 of 1 (latest)

sly nexusBOT
#

Hi @elder glade. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, it seems you are trying to use the Zod library for schema validation in your Next.js application. Zod is indeed recommended for advanced server-side validation in Next.js as per the Next.js documentation (https://nextjs.org/docs/pages/building-your-application/data-fetching/forms-and-mutations#form-validation).

However, the specific code you provided is not present in the extracts, so I can't provide a direct answer or validation for it.

In general, to validate an array of objects with Zod, you would use z.array(z.object({...})) as you have done in your code. This should validate each object in the galleryTour array according to the schema you've defined inside z.object({...}).

For more specific help with your code, I would recommend referring to the Zod documentation (https://zod.dev/) or seeking advice on a platform like StackOverflow.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: