ITADN

Support for Arrays as input type

#227OpenMilanDeruelle 创建于 2024-10-31
M
MilanDeruellecommented
Hello everyone, I'm building an API using ZSA. The problem is, any input I'm getting are getting converted to an object before getting validated. In my case, the input should be an array of objects, but having z.array(z.object({}).passthrough()) as an input type throws a validation error because the array was transformed into an object with the structure {'0': {...}, '1':{...},...}. I have a workaround using preprocess with v=>Object.values(v) but this still seems to be undesired behaviour/a bug Thanks and best regards, Milan
0 条评论