You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
The problem is that when using tools like Automapper, Mapped types lose their functionality because Automapper requires each field to be decorated with @AutoMap().
With this solution, users can select which fields to decorate or apply decoration to all fields if needed. This offers greater control and customization in field decoration.
This Gist demonstrates the functionality I described in "Describe the solution you'd like." However, I haven't submitted a pull request because I believe this functionality should be added to all Mapped Types and thoroughly tested, which I currently don't have time for. But the gist works effectively for me!
Also worth mentioning, when defining the PartialType second parameter it instantly tries to execute the decorator which is not being used which causes an error, I did fix it in my Gist but I don't know if the fix itself is good since I used AI for this.
What is the motivation / use case for changing the behavior?
The motivation for changing the behavior is to provide users with greater flexibility and control over field decoration when using tools like AutoMap in NestJS mapped types. By allowing users to specify which fields should be decorated, they can tailor the mapping configuration to their specific needs.
The text was updated successfully, but these errors were encountered:
Due to time constraints and my shift away from GraphQL, I'm unable to create a PR for this issue. Upon further reflection, I also believe this issue would be better suited for the NestJS core repository.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
The problem is that when using tools like Automapper, Mapped types lose their functionality because Automapper requires each field to be decorated with @AutoMap().
When looking for a solution, I found a Stack Overflow post that describes the same problem I'm experiencing: https://stackoverflow.com/questions/77825626/automapper-and-mapped-type-in-nest-js
Describe the solution you'd like
Here's the solution I believe would be best and flexible:
Developers will have the option to use the customFields parameter, which takes two parameters:
With this solution, users can select which fields to decorate or apply decoration to all fields if needed. This offers greater control and customization in field decoration.
Teachability, documentation, adoption, migration strategy
I've already created a custom mapped type available here: https://gist.github.com/Copystrike/bfc5010100aba362002616f9eca7fa25
This Gist demonstrates the functionality I described in "Describe the solution you'd like." However, I haven't submitted a pull request because I believe this functionality should be added to all Mapped Types and thoroughly tested, which I currently don't have time for. But the gist works effectively for me!
Also worth mentioning, when defining the PartialType second parameter it instantly tries to execute the
decorator
which is not being used which causes an error, I did fix it in my Gist but I don't know if the fix itself is good since I used AI for this.What is the motivation / use case for changing the behavior?
The motivation for changing the behavior is to provide users with greater flexibility and control over field decoration when using tools like AutoMap in NestJS mapped types. By allowing users to specify which fields should be decorated, they can tailor the mapping configuration to their specific needs.
The text was updated successfully, but these errors were encountered: