Skip to content

Commit 0296a82

Browse files
author
Eric Butler
authoredSep 28, 2023
feat(zod): support array min/max items (#908)
1 parent 993d227 commit 0296a82

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎packages/zod/src/index.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,17 @@ const generateZodValidationSchemaDefinition = (
6262
const required = schema.default !== undefined ? false : _required ?? false;
6363
const nullable = schema.nullable ?? false;
6464
const min =
65-
schema.minimum ?? schema.exclusiveMinimum ?? schema.minLength ?? undefined;
65+
schema.minimum ??
66+
schema.exclusiveMinimum ??
67+
schema.minLength ??
68+
schema.minItems ??
69+
undefined;
6670
const max =
67-
schema.maximum ?? schema.exclusiveMaximum ?? schema.maxLength ?? undefined;
71+
schema.maximum ??
72+
schema.exclusiveMaximum ??
73+
schema.maxLength ??
74+
schema.maxItems ??
75+
undefined;
6876
const matches = schema.pattern ?? undefined;
6977

7078
switch (type) {

0 commit comments

Comments
 (0)
Please sign in to comment.