export function contextInputValidation( callback: (options: { ctx: Context }) => zod.Schema,) { return middleware(async ({ next, ctx, rawInput }) => { const schema = callback({ ctx }); const input = schema.parse(rawInput); const stack = await next({ rawInput: input, }); return stack; });}
rawInput
input
request .use(contextInputValidation(({ ctx }) => schema)) .mutation(async ({ ctx, input, rawInput }) => { ... })