safwan.rahman12mo ago

Is it possible to access context in input?

Hi, I have a validator that requires to get context of prisma in the input, Is it possible to get the context in the input? There are some fields that are required for some users, I would like to handle this in validator level using zod.
1 Reply
Nick12mo ago
I believe when passing a function you can receive the context, but validators aren’t really intended to do that sort of work, just define the shape of the input, you could use a middleware or write these checks into the procedure