Skip to content

Commit 7700d41

Browse files
authored
Merge pull request #240 from enormora/renovate/zod-3.x
⬆️ Update dependency zod to v3.25.76
2 parents 5b5152b + 2d69876 commit 7700d41

File tree

10 files changed

+374
-338
lines changed

10 files changed

+374
-338
lines changed

integration-tests/zod-error-formatter/max.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ test('formats messages for invalid string schemas with length boundary correctly
2020

2121
assert.strictEqual(result.success, false);
2222
assert.deepStrictEqual(result.error.issues, [
23-
'string must contain less than 3 characters'
23+
'string must contain exactly 3 characters'
2424
]);
2525
});

integration-tests/zod-error-formatter/min.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ test('formats messages for invalid array schemas with length boundary correctly'
2020

2121
assert.strictEqual(result.success, false);
2222
assert.deepStrictEqual(result.error.issues, [
23-
'array must contain more than 3 elements'
23+
'array must contain exactly 3 elements'
2424
]);
2525
});

package-lock.json

Lines changed: 330 additions & 330 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@
4747
"eslint": "9.31.0",
4848
"sinon": "20.0.0",
4949
"typescript": "5.8.3",
50-
"zod": "3.25.67"
50+
"zod": "4.0.5"
5151
},
5252
"engines": {
5353
"node": "^22"
5454
},
5555
"peerDependencies": {
56-
"zod": "^3.25.50"
56+
"zod": "^4.0.5"
5757
}
5858
}

source/zod-error-formatter/issue-specific/too-big.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,17 @@ test('formats the predicate correctly when inclusive false for date type', () =>
313313
});
314314
assert.strictEqual(message, 'date must be smaller than Thu, 01 Jan 1970 00:00:00 GMT');
315315
});
316+
317+
test('formats the predicate correctly when exact is true', () => {
318+
const message = formatTooBigIssueMessage({
319+
code: 'too_big',
320+
path: [],
321+
message: '',
322+
input: '',
323+
origin: 'number',
324+
maximum: 1,
325+
exact: true,
326+
inclusive: false
327+
});
328+
assert.strictEqual(message, 'number must be exactly 1');
329+
});

source/zod-error-formatter/issue-specific/too-big.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ function formatInclusivePredicate(
1515
}
1616

1717
function formatPredicate(issue: $ZodIssueTooBig): string {
18+
if (issue.exact === true) {
19+
return 'exactly';
20+
}
21+
1822
if (collectionTypes.has(issue.origin)) {
1923
return formatInclusivePredicate(issue, 'at most', 'less than');
2024
}

source/zod-error-formatter/issue-specific/too-small.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,17 @@ test('formats the predicate correctly when inclusive false for date type', () =>
273273
});
274274
assert.strictEqual(message, 'date must be greater than Thu, 01 Jan 1970 00:00:00 GMT');
275275
});
276+
277+
test('formats the predicate correctly when exact is true', () => {
278+
const message = formatTooSmallIssueMessage({
279+
code: 'too_small',
280+
path: [],
281+
message: '',
282+
input: '',
283+
origin: 'number',
284+
minimum: 1,
285+
exact: true,
286+
inclusive: true
287+
});
288+
assert.strictEqual(message, 'number must be exactly 1');
289+
});

source/zod-error-formatter/issue-specific/too-small.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ function formatInclusivePredicate(
1515
}
1616

1717
function formatPredicate(issue: $ZodIssueTooSmall): string {
18+
if (issue.exact === true) {
19+
return 'exactly';
20+
}
21+
1822
if (collectionTypes.has(issue.origin)) {
1923
return formatInclusivePredicate(issue, 'at least', 'more than');
2024
}

source/zod-graphql-client/client.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ function clientFactory(overrides: Overrides): GraphqlClient {
4343
return createClient(options);
4444
}
4545

46-
const simpleQuerySchema = z.object({ foo: z.string() }).strict();
46+
const simpleQuerySchema = z.strictObject({ foo: z.string() });
4747
const queryWithVariablesSchema = z
48-
.object({ foo: graphqlFieldOptions(z.string(), { parameters: { bar: variablePlaceholder('$bar') } }) })
49-
.strict();
48+
.strictObject({ foo: graphqlFieldOptions(z.string(), { parameters: { bar: variablePlaceholder('$bar') } }) });
5049

5150
test('query() sends the query derived from the given schema to the configured endpoint', async () => {
5251
const post = createFakeKyMethod();
@@ -207,6 +206,7 @@ test('query() sends the query variables when given', async () => {
207206
test('query() returns a network failure result when the request times out', async () => {
208207
const post = createFakeKyMethod({ error: new TimeoutError({} as unknown as Request) });
209208
const client = clientFactory({ post });
209+
// @ts-expect-error -- https://github.com/colinhacks/zod/issues/4611
210210
const result = await client.query(simpleQuerySchema);
211211

212212
assert.deepStrictEqual(result, {

source/zod-graphql-query-builder/query-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { type CustomScalarSchema, isCustomScalarSchema } from './custom-scalar.j
2525

2626
export interface StrictObjectSchema<Shape extends $ZodShape> extends $ZodObject<Shape, $strict> {}
2727

28-
// @ts-expect-error -- ok in this case
28+
// @ts-expect-error -- https://github.com/colinhacks/zod/issues/4611
2929
export function isStrictObjectSchema(schema: unknown): schema is StrictObjectSchema<FieldShape> {
3030
return schema instanceof $ZodObject;
3131
}

0 commit comments

Comments
 (0)