Skip to content

Error shown in a wrong field in Zod 4 Array schema #190

@glekner

Description

@glekner

Since upgrading to the latest v5,Error shown in a wrong field in Zod 4 Array schema.

Schema is:

      z.array(
        z.object({
          text: z.string().describe('Text'),
          url: z
            .string()
            .regex(/^\/[^\s]*$/, 'URL must be a relative path starting with /')
            .describe('URL (e.g., /docs/x)'),
          type: z.enum(['text', 'video']).optional().describe('Type'),
        })
      )

and i'm seeing an error that is suppose to be only in the url field also in the type field

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions