© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
3 replies
tzezar

select and alter columns with drizzle-zod

Hi, I want to create validation schema for update patch request. Not sure how it should be done. I want to (based on drizzle schema) select which field is updatable and mark everyfield as optional.

I tried:
const requestSchema = createDocumentSublineSchema.pick({
  quantityInBaseUnit: true,
});

const updateDocumentSublineSchema = createInsertSchema(documentSubline, {
  quantityInBaseUnit: (schema) => schema.quantityInBaseUnit.optional(),
});
const requestSchema = createDocumentSublineSchema.pick({
  quantityInBaseUnit: true,
});

const updateDocumentSublineSchema = createInsertSchema(documentSubline, {
  quantityInBaseUnit: (schema) => schema.quantityInBaseUnit.optional(),
});

this does not work, I must be missing something
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Help, Partial select with drizzle-zod
Drizzle TeamDTDrizzle Team / help
2y ago
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
Drizzle TeamDTDrizzle Team / help
3y ago
Drizzle-zod combined with regular zod? 🙃
Drizzle TeamDTDrizzle Team / help
15mo ago
Drizzle Zod with relations
Drizzle TeamDTDrizzle Team / help
2y ago