Skip to content

Commit 19888e9

Browse files
committed
feat(json-api-nestjs): bump zod to v4
1 parent bdacd06 commit 19888e9

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

libs/json-api/json-api-nestjs/src/lib/modules/mixin/zod/map-transform-to-json-shema.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
11
import type { JSONSchema } from 'zod/v4/core';
22

3-
type DateStringTransform<
4-
Null extends true | false,
5-
isPatch extends true | false
6-
> = isPatch extends true
7-
?
8-
Null extends true ? Date | null | undefined : Date | undefined
9-
:
10-
Null extends true ? Date | null | undefined : Date;
11-
12-
export function transformDateString<
13-
Null extends true | false,
14-
isPatch extends true | false
15-
>(i: string | null | undefined): DateStringTransform<Null, isPatch> {
16-
17-
if (i === null || i === undefined) {
18-
return i as DateStringTransform<Null, isPatch>;
19-
}
20-
return new Date(i)
3+
export function transformDateString(i: string | null | undefined) {
4+
return i === null || i === undefined ? i : new Date(i);
215
}
226

237
export function transformStringToArray(input: string | undefined) {

libs/json-api/json-api-nestjs/src/lib/modules/mixin/zod/zod-share/attributes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function getZodRulesForDate<
2626
Null extends true | false,
2727
isPatch extends true | false
2828
>(isNullable: Null, isPatch: isPatch) {
29-
return setOptionalOrNot(z.iso.datetime(), isNullable, isPatch).transform(transformDateString<Null, isPatch>);
29+
return setOptionalOrNot(z.iso.datetime(), isNullable, isPatch).transform(transformDateString);
3030
}
3131

3232
function getZodRulesForBoolean<

0 commit comments

Comments
 (0)