diff --git a/packages/zod/src/index.ts b/packages/zod/src/index.ts index c281f3ce6..4c4d4d5ee 100644 --- a/packages/zod/src/index.ts +++ b/packages/zod/src/index.ts @@ -214,13 +214,14 @@ const generateZodValidationSchemaDefinition = ( } if (schema.enum && type !== 'number') { - const enumValues = schema.enum.map((value) => - isString(value) ? `'${escape(value)}'` : `${value}`, - ); - if (!schema.required) { - enumValues.push(`""`); - } - functions.push(['enum', [`[${enumValues.join(', ')}]`]]); + functions.push([ + 'enum', + [ + `[${schema.enum + .map((value) => (isString(value) ? `'${escape(value)}'` : `${value}`)) + .join(', ')}]`, + ], + ]); } if (!required && nullable) {