-
Notifications
You must be signed in to change notification settings - Fork 403
Array parameters are not deserialized/validated properly #123
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
Comments
The second part of this issue regarding type coercion for nested values may not actually be possible. It seems the only type metadata available for array primitives is @pleerock are there any other options here? I think |
Right, its not possible to automatically find type of "string[]". You can do it with class-transformer, but your type should be object and inside it you should have your string[] with type set. Alternative could be to have |
So it looks like all the problems with class-validator and class-transformer comes to one solution - #122 😉 I will try to look at the source code to see how much complicated is the implementation of this feature and whether I could help and contribute. |
I'll close it. If someone interested in fixing this issue feel free to create a PR. But I personally think it does not worth it. Better to create object and let class-transfromer to perform proper transformation directly into the object, instead of having each array in a separate query parameter. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Given the following decorated parameters on a controller method:
... the behavior of arrays in query parameters is inconsistent. Namely single values are not coerced to an array and the inner values are not coerced or validated against the appropriate type. Some examples:
The text was updated successfully, but these errors were encountered: