Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Arrays as input type #227

Open
MilanDeruelle opened this issue Oct 31, 2024 · 0 comments
Open

Support for Arrays as input type #227

MilanDeruelle opened this issue Oct 31, 2024 · 0 comments

Comments

@MilanDeruelle
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant