Can we send param with zod.parse() #1074
Answered
by
scotttrinh
caglar-yildiz
asked this question in
Q&A
-
Hello, |
Beta Was this translation helpful? Give feedback.
Answered by
scotttrinh
Apr 7, 2022
Replies: 1 comment
-
In that case you'll need to make the schema dynamically within the request. A simple pseudo-code example: function routeHandler(req) {
const schema = z.object({
params: z.object({
_id: z.string({ required_error: getMessage(req.body.lang) }),
}),
});
// can use the schema here for whatever validation you are trying to do
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
caglar-yildiz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In that case you'll need to make the schema dynamically within the request. A simple pseudo-code example: