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