input using z.or not working properly
i have an input like this
let input = z.object({
name: z.string().optional()
}).or(z.object({
id: z.number().optional()
}));
when I call the route with { name: "123" } I get in the input { name: "123" } properly like I should,
but when I call the same route with { id: 2 } then I get in the input {} - the rawInput is correctly { id: 2 } but
the data is not transferred to input, when I switch the order of the input like this
let input = z.object({
id: z.number().optional()
}).or(z.object({
name: z.string().optional()
}));
then now, id is the one that works and name gives {}
this is probably a bug, should I post this in the git or maybe it wasn't supposed to work at all?
let input = z.object({
name: z.string().optional()
}).or(z.object({
id: z.number().optional()
}));
when I call the route with { name: "123" } I get in the input { name: "123" } properly like I should,
but when I call the same route with { id: 2 } then I get in the input {} - the rawInput is correctly { id: 2 } but
the data is not transferred to input, when I switch the order of the input like this
let input = z.object({
id: z.number().optional()
}).or(z.object({
name: z.string().optional()
}));
then now, id is the one that works and name gives {}
this is probably a bug, should I post this in the git or maybe it wasn't supposed to work at all?