Skip to content

Commit 9838f5a

Browse files
committed
feat(request): allow setting custom id schema for resource identifiers
1 parent 95da2ba commit 9838f5a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/request.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,16 @@ const fixedTypeSchema = <TType extends string>(type: TType) =>
120120

121121
type ResourceIdentifierSchema<TType extends string> = z.ZodObject<{
122122
type: z.ZodType<TType>;
123-
id: z.ZodString;
123+
id: z.ZodType<string>;
124124
}>;
125125

126126
export const resourceIdentifierSchema = <TType extends string>(
127127
type: TType,
128+
idSchema: z.ZodType<string> = z.string(),
128129
): ResourceIdentifierSchema<TType> =>
129130
z.object({
130131
type: fixedTypeSchema(type),
131-
id: z.string(),
132+
id: idSchema,
132133
});
133134

134135
type ClientResourceIdentifierSchema<TType extends string> = z.ZodObject<{

0 commit comments

Comments
 (0)