The .omit() method appears to fail when chained after .extend() on a createInsertSchema() result.

Is this an incorrect way to use Drizzle Zod?
export const insertLocationSchema = createInsertSchema(locations)
.extend({
city: z.string().min(1, { message: "City is required." }),
state: z.string().min(1, { message: "State is required." }),
})
.omit({
id: true,
createdAt: true,
updatedAt: true,
});
export const insertLocationSchema = createInsertSchema(locations)
.extend({
city: z.string().min(1, { message: "City is required." }),
state: z.string().min(1, { message: "State is required." }),
})
.omit({
id: true,
createdAt: true,
updatedAt: true,
});
1 Reply
MarvinKR
MarvinKROP2w ago
Seems like it's an issue that reappeared on drizzle-zod 0.8.3? Happy to pay the person who helps me on this issue: https://discord.com/channels/1043890932593987624/1437942193456414780 @Mario564 saw you answered on the Github thread but seems like that fix didn't work for later version of Drizzle-zod

Did you find this page helpful?