Skip to content

Commit a0ccbb4

Browse files
author
Quentin Nativel
committed
refactor: modify ConstrainedJsonZodSchema type to be also a ZodObject
1 parent 5f908e4 commit a0ccbb4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/aws-zod-interface-contracts/src/types/jsonZodSchema.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { z } from 'zod';
1+
import { z, ZodTypeAny } from 'zod';
22

33
const literalSchema = z.union([
44
z.string(),
@@ -12,5 +12,7 @@ type Json = Literal | { [key: string]: Json } | Json[];
1212
export type JsonZodSchema = z.ZodType<Json>;
1313

1414
const constrainedJsonZodSchema = z.record(z.union([z.string(), z.unknown()]));
15+
1516
type Constrained = z.infer<typeof constrainedJsonZodSchema>;
16-
export type ConstrainedJsonZodSchema = z.ZodType<Constrained>;
17+
export type ConstrainedJsonZodSchema = z.ZodType<Constrained> &
18+
z.ZodObject<{ [x: string]: ZodTypeAny }>;

0 commit comments

Comments
 (0)