[Map] When using additional property with a map, objects transformation is broken
SergioArrighi opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
I define two objects.
A basic one with a single property marker with @excluded
And a container one with a Map property <string, Think> (an index)
Then I return a dummy object from the controller
The swagger doc looks like this
In both the id field, marked as excluded, is displayed.
If you use an array
Thing[]
You will see that exclusion is correctly perfomed
Minimum reproduction code
https://gist.github.com/SergioArrighi/8c239e2f7e4e4f5f34261c95470b6b90
Steps to reproduce
- Create nest app: nest new things
- Add two provided files: thing.ts and things.ts
- In the controller add /test endpoint from file things.controller.ts
- Check specs and output
Expected behavior
I would expect that fields tagged with @exclude are hidden in this case too
Package version
7.1.17
NestJS version
10.0.0
Node.js version
16.19.1
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
Thanks for the awesome library!
I would expect that fields tagged with @exclude are hidden in this case too
Fields with @Exlude
are generally not hidden in any case. @nestjs/swagger
does not even take them into account unless you use a NestJS CLI Plugin with non-default settings
From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the # 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.