Closed mak7an closed 2 months ago
Multer (the underlying form body parser) makes everything that is not a file a string. You'll need to add an explicit @Transform()
if you want the ValidationPipe
to handle that
@jmcdo29 thank you, I didn't think about that
Is there an existing issue for this?
Current behavior
With
FileInterceptor
response is{"body":{"data":"test.mp3","test":"true"}}
. Test property if string but it is boolean.Without
FileInterceptor
response is`{"body":{"data":"test.mp3","test":true}}
. Test is boolean.If I use that body to update data
this.userRepository.assign(user, data)
I get errors from mikro-orm (bacause id is string and boolean values are string type) validation and nest validation pipe.Minimum reproduction code
https://github.com/nestjs/nest/tree/master/sample/29-file-upload
Steps to reproduce
No response
Expected behavior
Boolean to be boolean and integer integer.
Package
Other package
No response
NestJS version
No response
Packages versions
Just run sample
Node.js version
21.0.0
In which operating systems have you tested?
Other
No response