Open ivibumblebee opened 1 year ago
Upon a bit of further evaluation it seems like there is a workaround of adding an idempotent transformation function to the end of the zod definition. Something like
export const schema = z
.object({
field1: z.string(),
field2: z.string().transform((data) => changeTypeToInteger(data)),
})
.transform((i) => i);
Which implies that the issue is that the transformed type isn't taken into account when the top level isn't a zodEffect
even if the internals of it are.
@DudeRandom21 , That fixes the issue thanks!
In my query params, there is only one field I would like to modify, however if i define my schema in the form of the following:
Then using
processRequest
results in thefield2
field inreq.query
still being of the original type stringHowever if I define my schema in the form of the following:
Then the types are properly defined
I would like to be able to do nested transformations with
processRequest
however it seems this is not currently supported?