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(),
});

this does not work, I must be missing something
Was this page helpful?