Skip to content

Conversation

kevinmitch14
Copy link

@kevinmitch14 kevinmitch14 commented Oct 6, 2025

This caught me. Refinement gets lost and validation passes

const testPayload = {
  name: "Test",
  items: [],
};

const baseSchema = z.object({
  id: z.string(),
  name: z.string(),
  items: z.string().array(),
});

const failingSchema = baseSchema
  .superRefine((val, ctx) => {
    if (val.items.length === 0) {
      ctx.addIssue({
        message: "Must have at least one item",
        code: "custom",
        path: ["items"],
      });
    }
  })
  .omit({ id: true });

You also mention it here: #4874

@vercel
Copy link

vercel bot commented Oct 6, 2025

@kevinmitch14 is attempting to deploy a commit to the colinhacks Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant